Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
tar -t -v -f '/media/WD_USB/Signal_Security_bkp_Tue_Jan_15_ 2_16_32' -p /etc/crontab
V--------- 0/0 0 2019-01-15 02:16 20180203--Volume Header--
tar: /etc/crontab: Not found in archive
tar: Exiting with failure status due to previous errors
This was created with a backup of directory "/", why would /etc/crontab not be in there?
There are users crontab and system crontab files. As posted depending on distribution users crontab files including roots are saved in /var/spool/cron/crontabs/username. System crontab files are saved in /etc/crontab, /etc/cron.daily, /etc/cron.weekly, /etc/cron.hourly, /etc/cron.monthly.
Without knowing how your backup was created we can not say why /etc/crontab is missing. However, crontab is not used for system cron jobs so /etc/crontab should still be intact. Were you logged in as root or other user when you inadvertently hit return? Did root or that user actually have a crontab?
crontab will use stdin for inputs if you just press return but normally pressing ctrl-c will cancel.
tar normally strips off the leading "/" from paths, so "/etc/crontab" would be in the archive as "etc/crontab". But as others have pointed out, that is not the file you were replacing with the crontab command. You can check easily enough by looking at the current content of /etc/crontab.
Apparently, part of my problem is "/etc/crontab" versus "etc/crontab"
Still trying...and learning....
If you edited the root users crontab (that is, using crontab -e while logged in as root), you would still find it underneath the /var/spool/cron/crontabs directory. If you are referring to a system job (not the root user's crontab), your files might be underneath /etc/cron.d, /etc/cron.daily, etc, although /var Something I should have clarified earlier, what distro are you using? My responses have been from the perspective of a Debian based distro.
Forgive my ignorance, but what is "-p" argument for?
Its explicitly setting a pattern to search for. I didnt now it would work w/o it.
Quote:
Originally Posted by rknichols
tar normally strips off the leading "/" from paths, so "/etc/crontab" would be in the archive as "etc/crontab". But as others have pointed out, that is not the file you were replacing with the crontab command. You can check easily enough by looking at the current content of /etc/crontab.
OK, of course yall are right. The crontab file in the backup archive is exactly the same timestamp and filesize as the one currently in /etc/
So I looked for the root crontab, and its there, or seems to be...but I cant seem to extract it.
Code:
# tar -t -v -f '/media/WD_USB/Signal_Security_bkp_Tue_Jan_15_ 2_16_32' -p 'var/spool/cron/crontabs/root'
V--------- 0/0 0 2019-01-15 02:16 20180203--Volume Header--
-rw------- root/crontab 1123 2019-01-09 08:12 var/spool/cron/crontabs/root
# tar --extract --file="var/spool/cron/crontabs/root" '/media/WD_USB/Signal_Security_bkp_Tue_Jan_15_ 2_16_32'
tar: var/spool/cron/crontabs/root: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.