re-create default crontab [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








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.







share|improve this 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 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














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.







share|improve this 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 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












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.







share|improve this question















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









share|improve this question













share|improve this question




share|improve this question








edited May 16 at 6:00

























asked May 3 at 13:15









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 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
















  • 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















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










1 Answer
1






active

oldest

votes

















up vote
1
down vote













Cron utilizes two, quite independent sets of crontab files.



  1. 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.



  2. 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 the crontab command.

    A user’s crontab (including root, accessed using sudo crontab <option>) does not exist by default. When you issue crontab -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






share|improve this answer


















  • 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 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







  • 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 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

















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.



  1. 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.



  2. 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 the crontab command.

    A user’s crontab (including root, accessed using sudo crontab <option>) does not exist by default. When you issue crontab -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






share|improve this answer


















  • 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 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







  • 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 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














up vote
1
down vote













Cron utilizes two, quite independent sets of crontab files.



  1. 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.



  2. 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 the crontab command.

    A user’s crontab (including root, accessed using sudo crontab <option>) does not exist by default. When you issue crontab -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






share|improve this answer


















  • 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 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







  • 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 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












up vote
1
down vote










up vote
1
down vote









Cron utilizes two, quite independent sets of crontab files.



  1. 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.



  2. 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 the crontab command.

    A user’s crontab (including root, accessed using sudo crontab <option>) does not exist by default. When you issue crontab -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






share|improve this answer














Cron utilizes two, quite independent sets of crontab files.



  1. 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.



  2. 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 the crontab command.

    A user’s crontab (including root, accessed using sudo crontab <option>) does not exist by default. When you issue crontab -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







share|improve this answer














share|improve this answer



share|improve this answer








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 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







  • 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 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












  • 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 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







  • 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 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







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


Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491