Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 11536  / 2 Years ago, tue, april 5, 2022, 12:08:00

In my Ubuntu, my username is "meuser". When i do crontab -e, i can setup my rules. But instead of doing it with crontab -e, how can i do it directly to a file? Which file i cant modify?


More From » 11.04

 Answers
5

Quoting crontab's man page:




There is one file for each user's crontab under the
/var/spool/cron/crontabs directory. Users are not allowed to edit the
files under that directory directly to ensure that only users allowed
by the system to run periodic tasks can add them, and only
syntactically correct crontabs will be written there. This is enforced
by having the directory writable only by the crontab group and
configuring crontab command with the setgid bid set for that specific
group.




So you can't directly edit this file in a script (without sudoing around the restrictions). But, what you can do is the following: Just create a crontab file somewhere in the filesystem and then use



crontab <filename>


to install it.


[#42591] Wednesday, April 6, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
stantildlike

Total Points: 363
Total Questions: 135
Total Answers: 120

Location: Pitcairn Islands
Member since Fri, Dec 17, 2021
2 Years ago
;