SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I just made a big mistake. I was accessing my box externally (ssh) and accidentally deleted my crontab. I never used crontab before and issued the command "crontab -d" instead of "crontab -e" to edit and add my cronjob. I am pretty useless because I had no back up of my crontab of course
First question, is there going to be any direct issue on my box because of the crontab being erased ? (I am assuming so but do not know what type of problems..)
Lastly, would I be lucky enough so that there is a way to recover my crontab ? (having gone through Google and whatnote, I doubt it).
repo, thanks for your reply.
the incidence would be that none of the cronjobs that were there would be executed anymore as they are all gone --> OK, but would those cronjobs be similar to all slackware 13.1 install ? If yes, I could just ask someone with a slackware 13.1 install for all the cronjobs and recreate all of them. The point being is that i did not see the type of jobs that were in it so i have no clue the effects of those jobs not being executed.
Depends, did you erased them as user or as root?
What is the output from
Code:
crontab -l
Take a look at /etc/cron to see the crontabs still installed.
AFAIK crontab -d will only erase the contabs you created, not the system crontabs like cron-daily,cron-weekly...
Ops, it looks like the coffee didn't kick in yet...
crontab -d will delete the crontab of the user that ran it. Like repo said, the "system" crontabs (i.e. /etc/cron.daily, /etc/cron.weekly and etc.) should be "safe" even if you ran crontab -d as root.
Last edited by maxmiorim; 10-24-2010 at 06:06 AM.
Reason: DERP
Ops, it looks like the coffee didn't kick in yet...
crontab -d will delete the crontab of the user that ran it. Like repo said, the "system" crontabs (i.e. /etc/cron.daily, /etc/cron.weekly and etc.) should be "safe" even if you ran crontab -d as root.
Not quite. The root crontab file is what runs the jobs in those directories.
I did reinstall dcron but to no avail.
The dcron was still installed and I still have no scripts that run cron.daily/weekly/hourly/monthly..
I am in the process of installing a vm and will have look in it to see what can be done in that regards. Worst case scenarios, I will reinstall slack on my box.
Worst case scenarios, I will reinstall slack on my box.
Don't reinstall the whole OS just cause you deleted a crontab.
If you had a root crontab that had the original entries from an original install, just edit crontab as root and paste this into corntab.
as root do:
Code:
crontab -e
and then paste this code into and save it.
Code:
# If you don't want the output of a cron job mailed to you, you have to direct
# any output to /dev/null. We'll do this here since these jobs should run
# properly on a newly installed system, but if they don't the average newbie
# might get quite perplexed about getting strange mail every 5 minutes. :^)
#
# Run the hourly, daily, weekly, and monthly cron jobs.
# Jobs that need different timing may be entered into the crontab as before,
# but most really don't need greater granularity than this. If the exact
# times of the hourly, daily, weekly, and monthly cron jobs do not suit your
# needs, feel free to adjust them.
#
# Run hourly cron jobs at 47 minutes after the hour:
47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
#
# Run daily cron jobs at 4:40 every day:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
#
# Run weekly cron jobs at 4:30 on the first day of the week:
30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
That was the crontab from my Slackware 13.1 install that I just did two days ago, and there's no additional edits, so you may have had the exact same thing if you ran 13.1 with no changes.
Thanks a lot for your help. The crontab you posted helped a lot. I created a VM and got the exact same content. I recreated all the cron jobs and all his back to normal.
Thanks again guys for all your help. Much appreciated.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.