Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Deleted root's crontab

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
Boing Ball
Posts: 6
Joined: 2014-04-12 08:33

Deleted root's crontab

#1 Post by Boing Ball »

I accidentally replaced root's crontab with the system wide crontab on a new system, before I took full backup. Could anyone copy and paste Wheezy's default crontab for root here to save my time, please?

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Deleted root's crontab

#2 Post by dasein »

Or... you could solve this problem all by yourself in a matter of minutes, simply by copying the file over from a fresh install (even from inside a VM). ;)

And you might want to make that backup as soon as you're done copying.

Boing Ball
Posts: 6
Joined: 2014-04-12 08:33

Re: Deleted root's crontab

#3 Post by Boing Ball »

Woah, that was helpful. Why didn't you suggest reinstall?

lkraemer
Posts: 209
Joined: 2011-02-09 05:02
Been thanked: 4 times

Re: Deleted root's crontab

#4 Post by lkraemer »

On my Debian 7.x (64 Bit) install there is no root crontab as this shows:

Code: Select all

root@debian:~# crontab -l
no crontab for root
root@debian:~#
and I don't have any as user.

Larry

Boing Ball
Posts: 6
Joined: 2014-04-12 08:33

Re: Deleted root's crontab

#5 Post by Boing Ball »

lkraemer wrote:On my Debian 7.x (64 Bit) install there is no root crontab as this shows:

Code: Select all

root@debian:~# crontab -l
no crontab for root
root@debian:~#
and I don't have any as user.
Thanks for answering, but I swear I had one with content in it, when I first run crontab -e.

This is a cosmetic issue anyway, and that's why I would not want to spend much time to fix it. Just to wipe out a stupid error on my part.

lkraemer
Posts: 209
Joined: 2011-02-09 05:02
Been thanked: 4 times

Re: Deleted root's crontab

#6 Post by lkraemer »

in /etc there is a file named crontab with the following permissions:
-rw-r--r-- 1 root root 722 Jul 3 2012 crontab

larry@debian:/etc$ cat crontab

Code: Select all

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user	command
17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
Is that what you are looking for?

Larry

Boing Ball
Posts: 6
Joined: 2014-04-12 08:33

Re: Deleted root's crontab

#7 Post by Boing Ball »

lkraemer wrote: larry@debian:/etc$ cat crontab

Code: Select all

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user	command
17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
Is that what you are looking for?
No, this is system wide crontab that somehow replaced my root account's crontab. I have that one still intact.

lkraemer
Posts: 209
Joined: 2011-02-09 05:02
Been thanked: 4 times

Re: Deleted root's crontab

#8 Post by lkraemer »

OK tell me exactly what you want me to run to display the crontab you are looking for? As root or loginuser do this:

I've got a basically clean install as far as cron goes.

Larry

lkraemer
Posts: 209
Joined: 2011-02-09 05:02
Been thanked: 4 times

Re: Deleted root's crontab

#9 Post by lkraemer »

As root if I do a:

Code: Select all

crontab -e
root@debian:~# crontab -e
no crontab for root - using an empty one
No modification made
root@debian:~#
I get a file with the contents of:

Code: Select all

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
Larry

Boing Ball
Posts: 6
Joined: 2014-04-12 08:33

Re: Deleted root's crontab

#10 Post by Boing Ball »

lkraemer wrote: I get a file with the contents of:

Code: Select all

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
Thank you, that it is.

Post Reply