System Crontab or Root Crontab The 2019 Stack Overflow Developer Survey Results Are InAre there disadvantages/consequences to adding scheduled tasks directly to /etc/crontab instead of using the crontab command?What is the difference between using crontab -e and /etc/crontabExecute script at crontabWays to execute shell command as root?How do I add an entry to my crontab?Running program as root without using sudo with normal user accountHow to autostart a background program by a non-root user?Crontab does not run?OpenSUSE disabled root login (no root psswd set) >> yast, config issuesCrontab: Why won't it execute scriptnotify-send from root cronAdding/removing jobs in Debian crontab files?Differences between `/etc/crontab`, files under `/etc/cron.d/` and `/var/spool/cron/crontabs/root`?
Do these rules for Critical Successes and Critical Failures seem Fair?
How to notate time signature switching consistently every measure
What do the Banks children have against barley water?
Does a dangling wire really electrocute me if I'm standing in water?
Protecting Dualbooting Windows from dangerous code (like rm -rf)
Earliest use of the term "Galois extension"?
Can one be advised by a professor who is very far away?
How can I autofill dates in Excel excluding Sunday?
Are there incongruent pythagorean triangles with the same perimeter and same area?
Is bread bad for ducks?
Why hard-Brexiteers don't insist on a hard border to prevent illegal immigration after Brexit?
"as much details as you can remember"
Why is the maximum length of OpenWrt’s root password 8 characters?
Can someone be penalized for an "unlawful" act if no penalty is specified?
What is the closest word meaning "respect for time / mindful"
Is an up-to-date browser secure on an out-of-date OS?
How come people say “Would of”?
Deal with toxic manager when you can't quit
Is three citations per paragraph excessive for undergraduate research paper?
Is a "Democratic" Oligarchy-Style System Possible?
Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?
Is this app Icon Browser Safe/Legit?
What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?
Why isn't the circumferential light around the M87 black hole's event horizon symmetric?
System Crontab or Root Crontab
The 2019 Stack Overflow Developer Survey Results Are InAre there disadvantages/consequences to adding scheduled tasks directly to /etc/crontab instead of using the crontab command?What is the difference between using crontab -e and /etc/crontabExecute script at crontabWays to execute shell command as root?How do I add an entry to my crontab?Running program as root without using sudo with normal user accountHow to autostart a background program by a non-root user?Crontab does not run?OpenSUSE disabled root login (no root psswd set) >> yast, config issuesCrontab: Why won't it execute scriptnotify-send from root cronAdding/removing jobs in Debian crontab files?Differences between `/etc/crontab`, files under `/etc/cron.d/` and `/var/spool/cron/crontabs/root`?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
System crontab:
/etc/crontab
Root crontab:
sudo crontab -u root -e
Which way is preferred? As they all run tasks within administration privilege.
sudo cron root
add a comment |
System crontab:
/etc/crontab
Root crontab:
sudo crontab -u root -e
Which way is preferred? As they all run tasks within administration privilege.
sudo cron root
add a comment |
System crontab:
/etc/crontab
Root crontab:
sudo crontab -u root -e
Which way is preferred? As they all run tasks within administration privilege.
sudo cron root
System crontab:
/etc/crontab
Root crontab:
sudo crontab -u root -e
Which way is preferred? As they all run tasks within administration privilege.
sudo cron root
sudo cron root
asked May 3 '14 at 22:02
PeiPei
216148
216148
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
/etc/crontab
is the system wide crontab.
The format of /etc/crontab
is like this:
# m h dom mon dow user command
* * * * * someuser echo 'foo'
while crontab -e
is per user, it's worth mentioning with no -u
argument the crontab command goes to the current users crontab. You can do crontab -e -u <username>
to edit a specific users crontab.
Notice in a per user crontab there is no 'user' field.
# m h dom mon dow command
* * * * * echo 'foo'
An aspect of crontabs that may be confusing is that root also has its own crontab. e.g. crontab -e -u root
will not edit /etc/crontab
See Configuring cron.
In Linux distros, per user crontabs are typically stored in: /var/spool/crontabs/<username>
References
https://superuser.com/questions/290093/difference-between-etc-crontab-and-crontab-e
2
As Congiruring cron says: there is usually no need to create a user crontab for root. Is that true? I mean the standard way is to edit the /etc/crontab, am I right?
– Pei
May 3 '14 at 22:32
2
There is no "standard" way, thus you can have both files. I usually edit root's crontab and avoit/etc/crontab
just becaused I am used tocrontab -e
– phoops
May 3 '14 at 22:35
add a comment |
/etc/cron.d (and its siblings cron.daily/weekly/monthly) is preferred for all system crontabs. You shouldn't need to touch /etc/crontab.
It's essential to separate cron entries in multiple files, based on their functionality if you are planing to manage or automate things. Files under /etc/cron.d can be easily managed by packages or configuration management tools like puppet and chef. Root's crontab OTOH is practically un-maintenable by anything other than humans.
So in short, for system stuff you can use /etc/cron.*. If there's something you would like the root user to do then use root's crontab. /etc/crontab should be left untouched and managed by a package.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f127732%2fsystem-crontab-or-root-crontab%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
/etc/crontab
is the system wide crontab.
The format of /etc/crontab
is like this:
# m h dom mon dow user command
* * * * * someuser echo 'foo'
while crontab -e
is per user, it's worth mentioning with no -u
argument the crontab command goes to the current users crontab. You can do crontab -e -u <username>
to edit a specific users crontab.
Notice in a per user crontab there is no 'user' field.
# m h dom mon dow command
* * * * * echo 'foo'
An aspect of crontabs that may be confusing is that root also has its own crontab. e.g. crontab -e -u root
will not edit /etc/crontab
See Configuring cron.
In Linux distros, per user crontabs are typically stored in: /var/spool/crontabs/<username>
References
https://superuser.com/questions/290093/difference-between-etc-crontab-and-crontab-e
2
As Congiruring cron says: there is usually no need to create a user crontab for root. Is that true? I mean the standard way is to edit the /etc/crontab, am I right?
– Pei
May 3 '14 at 22:32
2
There is no "standard" way, thus you can have both files. I usually edit root's crontab and avoit/etc/crontab
just becaused I am used tocrontab -e
– phoops
May 3 '14 at 22:35
add a comment |
/etc/crontab
is the system wide crontab.
The format of /etc/crontab
is like this:
# m h dom mon dow user command
* * * * * someuser echo 'foo'
while crontab -e
is per user, it's worth mentioning with no -u
argument the crontab command goes to the current users crontab. You can do crontab -e -u <username>
to edit a specific users crontab.
Notice in a per user crontab there is no 'user' field.
# m h dom mon dow command
* * * * * echo 'foo'
An aspect of crontabs that may be confusing is that root also has its own crontab. e.g. crontab -e -u root
will not edit /etc/crontab
See Configuring cron.
In Linux distros, per user crontabs are typically stored in: /var/spool/crontabs/<username>
References
https://superuser.com/questions/290093/difference-between-etc-crontab-and-crontab-e
2
As Congiruring cron says: there is usually no need to create a user crontab for root. Is that true? I mean the standard way is to edit the /etc/crontab, am I right?
– Pei
May 3 '14 at 22:32
2
There is no "standard" way, thus you can have both files. I usually edit root's crontab and avoit/etc/crontab
just becaused I am used tocrontab -e
– phoops
May 3 '14 at 22:35
add a comment |
/etc/crontab
is the system wide crontab.
The format of /etc/crontab
is like this:
# m h dom mon dow user command
* * * * * someuser echo 'foo'
while crontab -e
is per user, it's worth mentioning with no -u
argument the crontab command goes to the current users crontab. You can do crontab -e -u <username>
to edit a specific users crontab.
Notice in a per user crontab there is no 'user' field.
# m h dom mon dow command
* * * * * echo 'foo'
An aspect of crontabs that may be confusing is that root also has its own crontab. e.g. crontab -e -u root
will not edit /etc/crontab
See Configuring cron.
In Linux distros, per user crontabs are typically stored in: /var/spool/crontabs/<username>
References
https://superuser.com/questions/290093/difference-between-etc-crontab-and-crontab-e
/etc/crontab
is the system wide crontab.
The format of /etc/crontab
is like this:
# m h dom mon dow user command
* * * * * someuser echo 'foo'
while crontab -e
is per user, it's worth mentioning with no -u
argument the crontab command goes to the current users crontab. You can do crontab -e -u <username>
to edit a specific users crontab.
Notice in a per user crontab there is no 'user' field.
# m h dom mon dow command
* * * * * echo 'foo'
An aspect of crontabs that may be confusing is that root also has its own crontab. e.g. crontab -e -u root
will not edit /etc/crontab
See Configuring cron.
In Linux distros, per user crontabs are typically stored in: /var/spool/crontabs/<username>
References
https://superuser.com/questions/290093/difference-between-etc-crontab-and-crontab-e
edited Mar 20 '17 at 10:18
Community♦
1
1
answered May 3 '14 at 22:12
RameshRamesh
24k34105188
24k34105188
2
As Congiruring cron says: there is usually no need to create a user crontab for root. Is that true? I mean the standard way is to edit the /etc/crontab, am I right?
– Pei
May 3 '14 at 22:32
2
There is no "standard" way, thus you can have both files. I usually edit root's crontab and avoit/etc/crontab
just becaused I am used tocrontab -e
– phoops
May 3 '14 at 22:35
add a comment |
2
As Congiruring cron says: there is usually no need to create a user crontab for root. Is that true? I mean the standard way is to edit the /etc/crontab, am I right?
– Pei
May 3 '14 at 22:32
2
There is no "standard" way, thus you can have both files. I usually edit root's crontab and avoit/etc/crontab
just becaused I am used tocrontab -e
– phoops
May 3 '14 at 22:35
2
2
As Congiruring cron says: there is usually no need to create a user crontab for root. Is that true? I mean the standard way is to edit the /etc/crontab, am I right?
– Pei
May 3 '14 at 22:32
As Congiruring cron says: there is usually no need to create a user crontab for root. Is that true? I mean the standard way is to edit the /etc/crontab, am I right?
– Pei
May 3 '14 at 22:32
2
2
There is no "standard" way, thus you can have both files. I usually edit root's crontab and avoit
/etc/crontab
just becaused I am used to crontab -e
– phoops
May 3 '14 at 22:35
There is no "standard" way, thus you can have both files. I usually edit root's crontab and avoit
/etc/crontab
just becaused I am used to crontab -e
– phoops
May 3 '14 at 22:35
add a comment |
/etc/cron.d (and its siblings cron.daily/weekly/monthly) is preferred for all system crontabs. You shouldn't need to touch /etc/crontab.
It's essential to separate cron entries in multiple files, based on their functionality if you are planing to manage or automate things. Files under /etc/cron.d can be easily managed by packages or configuration management tools like puppet and chef. Root's crontab OTOH is practically un-maintenable by anything other than humans.
So in short, for system stuff you can use /etc/cron.*. If there's something you would like the root user to do then use root's crontab. /etc/crontab should be left untouched and managed by a package.
add a comment |
/etc/cron.d (and its siblings cron.daily/weekly/monthly) is preferred for all system crontabs. You shouldn't need to touch /etc/crontab.
It's essential to separate cron entries in multiple files, based on their functionality if you are planing to manage or automate things. Files under /etc/cron.d can be easily managed by packages or configuration management tools like puppet and chef. Root's crontab OTOH is practically un-maintenable by anything other than humans.
So in short, for system stuff you can use /etc/cron.*. If there's something you would like the root user to do then use root's crontab. /etc/crontab should be left untouched and managed by a package.
add a comment |
/etc/cron.d (and its siblings cron.daily/weekly/monthly) is preferred for all system crontabs. You shouldn't need to touch /etc/crontab.
It's essential to separate cron entries in multiple files, based on their functionality if you are planing to manage or automate things. Files under /etc/cron.d can be easily managed by packages or configuration management tools like puppet and chef. Root's crontab OTOH is practically un-maintenable by anything other than humans.
So in short, for system stuff you can use /etc/cron.*. If there's something you would like the root user to do then use root's crontab. /etc/crontab should be left untouched and managed by a package.
/etc/cron.d (and its siblings cron.daily/weekly/monthly) is preferred for all system crontabs. You shouldn't need to touch /etc/crontab.
It's essential to separate cron entries in multiple files, based on their functionality if you are planing to manage or automate things. Files under /etc/cron.d can be easily managed by packages or configuration management tools like puppet and chef. Root's crontab OTOH is practically un-maintenable by anything other than humans.
So in short, for system stuff you can use /etc/cron.*. If there's something you would like the root user to do then use root's crontab. /etc/crontab should be left untouched and managed by a package.
edited Apr 7 at 13:46
answered May 3 '14 at 22:36
V13V13
2,877713
2,877713
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f127732%2fsystem-crontab-or-root-crontab%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown