re-create default crontab [duplicate]
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
3
down vote
favorite
This question already has an answer here:
Resetting crontab file to default
1 answer
In my attempt to make a new crontab file work on 16.04, I made the following mistake as root:
sudo su root
crontab /etc/cron.d/myjob
I realized too late that I must've changed some default crontab behaviour, ie regarding crontab -e
. I tried to roll back like this:
# still as root:
crontab /etc/crontab
Is that the correct default setting?
If not, then what is?
PS: The related issue does not answer my question. The answer there only states how to remove a crontab, not how to re-generate the default Ubuntu installation settings which is what I need to know.
cron
marked as duplicate by karel, Fabby, Eric Carvalho, MadMike, vidarlo May 5 at 21:10
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
3
down vote
favorite
This question already has an answer here:
Resetting crontab file to default
1 answer
In my attempt to make a new crontab file work on 16.04, I made the following mistake as root:
sudo su root
crontab /etc/cron.d/myjob
I realized too late that I must've changed some default crontab behaviour, ie regarding crontab -e
. I tried to roll back like this:
# still as root:
crontab /etc/crontab
Is that the correct default setting?
If not, then what is?
PS: The related issue does not answer my question. The answer there only states how to remove a crontab, not how to re-generate the default Ubuntu installation settings which is what I need to know.
cron
marked as duplicate by karel, Fabby, Eric Carvalho, MadMike, vidarlo May 5 at 21:10
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Thanks. Your linked issue indicates that the original root crontab was empty. Mine wasn't. I didn't add anything to it myself; I don't know what was in there; I just caught a glimpse of it withcrontab -e
before I messed up. It was a 3 weeks old 16.04 Unity installation. It must've been the one that ships with the installation; is that/etc/crontab
?
â Jonas Ellehauge
May 4 at 6:29
Here is the contents of/etc/crontab
: gist.github.com/ellvtr/c9f804e277d8bd3683766115c68a7877
â Jonas Ellehauge
May 4 at 6:47
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
This question already has an answer here:
Resetting crontab file to default
1 answer
In my attempt to make a new crontab file work on 16.04, I made the following mistake as root:
sudo su root
crontab /etc/cron.d/myjob
I realized too late that I must've changed some default crontab behaviour, ie regarding crontab -e
. I tried to roll back like this:
# still as root:
crontab /etc/crontab
Is that the correct default setting?
If not, then what is?
PS: The related issue does not answer my question. The answer there only states how to remove a crontab, not how to re-generate the default Ubuntu installation settings which is what I need to know.
cron
This question already has an answer here:
Resetting crontab file to default
1 answer
In my attempt to make a new crontab file work on 16.04, I made the following mistake as root:
sudo su root
crontab /etc/cron.d/myjob
I realized too late that I must've changed some default crontab behaviour, ie regarding crontab -e
. I tried to roll back like this:
# still as root:
crontab /etc/crontab
Is that the correct default setting?
If not, then what is?
PS: The related issue does not answer my question. The answer there only states how to remove a crontab, not how to re-generate the default Ubuntu installation settings which is what I need to know.
This question already has an answer here:
Resetting crontab file to default
1 answer
cron
edited May 16 at 6:00
asked May 3 at 13:15
![](https://i.stack.imgur.com/vCvfA.jpg?s=32&g=1)
![](https://i.stack.imgur.com/vCvfA.jpg?s=32&g=1)
Jonas Ellehauge
163
163
marked as duplicate by karel, Fabby, Eric Carvalho, MadMike, vidarlo May 5 at 21:10
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by karel, Fabby, Eric Carvalho, MadMike, vidarlo May 5 at 21:10
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Thanks. Your linked issue indicates that the original root crontab was empty. Mine wasn't. I didn't add anything to it myself; I don't know what was in there; I just caught a glimpse of it withcrontab -e
before I messed up. It was a 3 weeks old 16.04 Unity installation. It must've been the one that ships with the installation; is that/etc/crontab
?
â Jonas Ellehauge
May 4 at 6:29
Here is the contents of/etc/crontab
: gist.github.com/ellvtr/c9f804e277d8bd3683766115c68a7877
â Jonas Ellehauge
May 4 at 6:47
add a comment |Â
Thanks. Your linked issue indicates that the original root crontab was empty. Mine wasn't. I didn't add anything to it myself; I don't know what was in there; I just caught a glimpse of it withcrontab -e
before I messed up. It was a 3 weeks old 16.04 Unity installation. It must've been the one that ships with the installation; is that/etc/crontab
?
â Jonas Ellehauge
May 4 at 6:29
Here is the contents of/etc/crontab
: gist.github.com/ellvtr/c9f804e277d8bd3683766115c68a7877
â Jonas Ellehauge
May 4 at 6:47
Thanks. Your linked issue indicates that the original root crontab was empty. Mine wasn't. I didn't add anything to it myself; I don't know what was in there; I just caught a glimpse of it with
crontab -e
before I messed up. It was a 3 weeks old 16.04 Unity installation. It must've been the one that ships with the installation; is that /etc/crontab
?â Jonas Ellehauge
May 4 at 6:29
Thanks. Your linked issue indicates that the original root crontab was empty. Mine wasn't. I didn't add anything to it myself; I don't know what was in there; I just caught a glimpse of it with
crontab -e
before I messed up. It was a 3 weeks old 16.04 Unity installation. It must've been the one that ships with the installation; is that /etc/crontab
?â Jonas Ellehauge
May 4 at 6:29
Here is the contents of
/etc/crontab
: gist.github.com/ellvtr/c9f804e277d8bd3683766115c68a7877â Jonas Ellehauge
May 4 at 6:47
Here is the contents of
/etc/crontab
: gist.github.com/ellvtr/c9f804e277d8bd3683766115c68a7877â Jonas Ellehauge
May 4 at 6:47
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
Cron utilizes two, quite independent sets of crontab files.
One of them is public (system-wide), located in
/etc
. It includes/etc/crontab
and the files in/etc/cron.d
.
The file you linked looks much like the default/etc/crontab
. If you have got this contents in your/etc/crontab
file, keep it.The other includes a private file for each user. Their actual location is
/var/spool/cron/crontabs
but this folder is not accessible by normal means. These crontab files shall be accessed and modified using thecrontab
command.
A userâÂÂs crontab (including root, accessed usingsudo crontab <option>
) does not exist by default. When you issuecrontab -e
and have no crontab file for given user, the command brings a template with no scheduled commands, just descriptive comments. The file is saved only if you modify the template.
To reset this one to the default state (i.e. remove it), use the command:crontab -r
1
The user crontab is functionally empty but contains informative comments at the start, iirc.
â muru
May 4 at 7:28
@muru You are almost right. If you open the empty crontab usingcrontab
command, you get some placeholder comments. However, they arenâÂÂt stored in the/var/spool/cron/crontabs
until you save your own crontab.
â Melebius
May 4 at 7:29
sudo contab -e
was not empty before I messed it up. It had actual jobs in there, not just the standard comments. If it was empty by the Ubuntu installation - I only got a short glimpse of it. I assume some applications have added root cronjobs after the installation then.
â Jonas Ellehauge
May 16 at 6:03
1
@JonasEllehauge the root user's crontab is empty by default. Any packages that need to run cronjobs use the/etc/cron.*
directories. No package edits the root user's crontab.
â muru
May 16 at 6:15
Thanks, good to know. There were some entries in mine and I didn't add them manually. Here's what's in there now17 * * * * root cd / && run-parts --report /etc/cron.hourly /n 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) [+more anacron entries]
. Looks like anaconda added some. The first one looks like a system entry to me.
â Jonas Ellehauge
May 17 at 6:00
 |Â
show 3 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Cron utilizes two, quite independent sets of crontab files.
One of them is public (system-wide), located in
/etc
. It includes/etc/crontab
and the files in/etc/cron.d
.
The file you linked looks much like the default/etc/crontab
. If you have got this contents in your/etc/crontab
file, keep it.The other includes a private file for each user. Their actual location is
/var/spool/cron/crontabs
but this folder is not accessible by normal means. These crontab files shall be accessed and modified using thecrontab
command.
A userâÂÂs crontab (including root, accessed usingsudo crontab <option>
) does not exist by default. When you issuecrontab -e
and have no crontab file for given user, the command brings a template with no scheduled commands, just descriptive comments. The file is saved only if you modify the template.
To reset this one to the default state (i.e. remove it), use the command:crontab -r
1
The user crontab is functionally empty but contains informative comments at the start, iirc.
â muru
May 4 at 7:28
@muru You are almost right. If you open the empty crontab usingcrontab
command, you get some placeholder comments. However, they arenâÂÂt stored in the/var/spool/cron/crontabs
until you save your own crontab.
â Melebius
May 4 at 7:29
sudo contab -e
was not empty before I messed it up. It had actual jobs in there, not just the standard comments. If it was empty by the Ubuntu installation - I only got a short glimpse of it. I assume some applications have added root cronjobs after the installation then.
â Jonas Ellehauge
May 16 at 6:03
1
@JonasEllehauge the root user's crontab is empty by default. Any packages that need to run cronjobs use the/etc/cron.*
directories. No package edits the root user's crontab.
â muru
May 16 at 6:15
Thanks, good to know. There were some entries in mine and I didn't add them manually. Here's what's in there now17 * * * * root cd / && run-parts --report /etc/cron.hourly /n 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) [+more anacron entries]
. Looks like anaconda added some. The first one looks like a system entry to me.
â Jonas Ellehauge
May 17 at 6:00
 |Â
show 3 more comments
up vote
1
down vote
Cron utilizes two, quite independent sets of crontab files.
One of them is public (system-wide), located in
/etc
. It includes/etc/crontab
and the files in/etc/cron.d
.
The file you linked looks much like the default/etc/crontab
. If you have got this contents in your/etc/crontab
file, keep it.The other includes a private file for each user. Their actual location is
/var/spool/cron/crontabs
but this folder is not accessible by normal means. These crontab files shall be accessed and modified using thecrontab
command.
A userâÂÂs crontab (including root, accessed usingsudo crontab <option>
) does not exist by default. When you issuecrontab -e
and have no crontab file for given user, the command brings a template with no scheduled commands, just descriptive comments. The file is saved only if you modify the template.
To reset this one to the default state (i.e. remove it), use the command:crontab -r
1
The user crontab is functionally empty but contains informative comments at the start, iirc.
â muru
May 4 at 7:28
@muru You are almost right. If you open the empty crontab usingcrontab
command, you get some placeholder comments. However, they arenâÂÂt stored in the/var/spool/cron/crontabs
until you save your own crontab.
â Melebius
May 4 at 7:29
sudo contab -e
was not empty before I messed it up. It had actual jobs in there, not just the standard comments. If it was empty by the Ubuntu installation - I only got a short glimpse of it. I assume some applications have added root cronjobs after the installation then.
â Jonas Ellehauge
May 16 at 6:03
1
@JonasEllehauge the root user's crontab is empty by default. Any packages that need to run cronjobs use the/etc/cron.*
directories. No package edits the root user's crontab.
â muru
May 16 at 6:15
Thanks, good to know. There were some entries in mine and I didn't add them manually. Here's what's in there now17 * * * * root cd / && run-parts --report /etc/cron.hourly /n 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) [+more anacron entries]
. Looks like anaconda added some. The first one looks like a system entry to me.
â Jonas Ellehauge
May 17 at 6:00
 |Â
show 3 more comments
up vote
1
down vote
up vote
1
down vote
Cron utilizes two, quite independent sets of crontab files.
One of them is public (system-wide), located in
/etc
. It includes/etc/crontab
and the files in/etc/cron.d
.
The file you linked looks much like the default/etc/crontab
. If you have got this contents in your/etc/crontab
file, keep it.The other includes a private file for each user. Their actual location is
/var/spool/cron/crontabs
but this folder is not accessible by normal means. These crontab files shall be accessed and modified using thecrontab
command.
A userâÂÂs crontab (including root, accessed usingsudo crontab <option>
) does not exist by default. When you issuecrontab -e
and have no crontab file for given user, the command brings a template with no scheduled commands, just descriptive comments. The file is saved only if you modify the template.
To reset this one to the default state (i.e. remove it), use the command:crontab -r
Cron utilizes two, quite independent sets of crontab files.
One of them is public (system-wide), located in
/etc
. It includes/etc/crontab
and the files in/etc/cron.d
.
The file you linked looks much like the default/etc/crontab
. If you have got this contents in your/etc/crontab
file, keep it.The other includes a private file for each user. Their actual location is
/var/spool/cron/crontabs
but this folder is not accessible by normal means. These crontab files shall be accessed and modified using thecrontab
command.
A userâÂÂs crontab (including root, accessed usingsudo crontab <option>
) does not exist by default. When you issuecrontab -e
and have no crontab file for given user, the command brings a template with no scheduled commands, just descriptive comments. The file is saved only if you modify the template.
To reset this one to the default state (i.e. remove it), use the command:crontab -r
edited Jun 4 at 13:28
answered May 4 at 7:25
Melebius
3,66841636
3,66841636
1
The user crontab is functionally empty but contains informative comments at the start, iirc.
â muru
May 4 at 7:28
@muru You are almost right. If you open the empty crontab usingcrontab
command, you get some placeholder comments. However, they arenâÂÂt stored in the/var/spool/cron/crontabs
until you save your own crontab.
â Melebius
May 4 at 7:29
sudo contab -e
was not empty before I messed it up. It had actual jobs in there, not just the standard comments. If it was empty by the Ubuntu installation - I only got a short glimpse of it. I assume some applications have added root cronjobs after the installation then.
â Jonas Ellehauge
May 16 at 6:03
1
@JonasEllehauge the root user's crontab is empty by default. Any packages that need to run cronjobs use the/etc/cron.*
directories. No package edits the root user's crontab.
â muru
May 16 at 6:15
Thanks, good to know. There were some entries in mine and I didn't add them manually. Here's what's in there now17 * * * * root cd / && run-parts --report /etc/cron.hourly /n 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) [+more anacron entries]
. Looks like anaconda added some. The first one looks like a system entry to me.
â Jonas Ellehauge
May 17 at 6:00
 |Â
show 3 more comments
1
The user crontab is functionally empty but contains informative comments at the start, iirc.
â muru
May 4 at 7:28
@muru You are almost right. If you open the empty crontab usingcrontab
command, you get some placeholder comments. However, they arenâÂÂt stored in the/var/spool/cron/crontabs
until you save your own crontab.
â Melebius
May 4 at 7:29
sudo contab -e
was not empty before I messed it up. It had actual jobs in there, not just the standard comments. If it was empty by the Ubuntu installation - I only got a short glimpse of it. I assume some applications have added root cronjobs after the installation then.
â Jonas Ellehauge
May 16 at 6:03
1
@JonasEllehauge the root user's crontab is empty by default. Any packages that need to run cronjobs use the/etc/cron.*
directories. No package edits the root user's crontab.
â muru
May 16 at 6:15
Thanks, good to know. There were some entries in mine and I didn't add them manually. Here's what's in there now17 * * * * root cd / && run-parts --report /etc/cron.hourly /n 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) [+more anacron entries]
. Looks like anaconda added some. The first one looks like a system entry to me.
â Jonas Ellehauge
May 17 at 6:00
1
1
The user crontab is functionally empty but contains informative comments at the start, iirc.
â muru
May 4 at 7:28
The user crontab is functionally empty but contains informative comments at the start, iirc.
â muru
May 4 at 7:28
@muru You are almost right. If you open the empty crontab using
crontab
command, you get some placeholder comments. However, they arenâÂÂt stored in the /var/spool/cron/crontabs
until you save your own crontab.â Melebius
May 4 at 7:29
@muru You are almost right. If you open the empty crontab using
crontab
command, you get some placeholder comments. However, they arenâÂÂt stored in the /var/spool/cron/crontabs
until you save your own crontab.â Melebius
May 4 at 7:29
sudo contab -e
was not empty before I messed it up. It had actual jobs in there, not just the standard comments. If it was empty by the Ubuntu installation - I only got a short glimpse of it. I assume some applications have added root cronjobs after the installation then.â Jonas Ellehauge
May 16 at 6:03
sudo contab -e
was not empty before I messed it up. It had actual jobs in there, not just the standard comments. If it was empty by the Ubuntu installation - I only got a short glimpse of it. I assume some applications have added root cronjobs after the installation then.â Jonas Ellehauge
May 16 at 6:03
1
1
@JonasEllehauge the root user's crontab is empty by default. Any packages that need to run cronjobs use the
/etc/cron.*
directories. No package edits the root user's crontab.â muru
May 16 at 6:15
@JonasEllehauge the root user's crontab is empty by default. Any packages that need to run cronjobs use the
/etc/cron.*
directories. No package edits the root user's crontab.â muru
May 16 at 6:15
Thanks, good to know. There were some entries in mine and I didn't add them manually. Here's what's in there now
17 * * * * root cd / && run-parts --report /etc/cron.hourly /n 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) [+more anacron entries]
. Looks like anaconda added some. The first one looks like a system entry to me.â Jonas Ellehauge
May 17 at 6:00
Thanks, good to know. There were some entries in mine and I didn't add them manually. Here's what's in there now
17 * * * * root cd / && run-parts --report /etc/cron.hourly /n 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) [+more anacron entries]
. Looks like anaconda added some. The first one looks like a system entry to me.â Jonas Ellehauge
May 17 at 6:00
 |Â
show 3 more comments
Thanks. Your linked issue indicates that the original root crontab was empty. Mine wasn't. I didn't add anything to it myself; I don't know what was in there; I just caught a glimpse of it with
crontab -e
before I messed up. It was a 3 weeks old 16.04 Unity installation. It must've been the one that ships with the installation; is that/etc/crontab
?â Jonas Ellehauge
May 4 at 6:29
Here is the contents of
/etc/crontab
: gist.github.com/ellvtr/c9f804e277d8bd3683766115c68a7877â Jonas Ellehauge
May 4 at 6:47