- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- cron & tar
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 01:46 PM
тАО02-20-2008 01:46 PM
#!/bin/sh
x="/some/path/$(date +%F)_mystuff.tar"
/bin/tar -cvf $x /path/to/backup
I know cron and shell are different, at
the command line it runs fine but in cron
it does nothing. Isn't this simple script
cron friendly?
TIA
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 01:55 PM
тАО02-20-2008 01:55 PM
Re: cron & tar
/bin/tar: Removing leading `/` from member names
But it does work and create the tar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 02:22 PM
тАО02-20-2008 02:22 PM
Re: cron & tar
#!/bin/sh
x="some/path/mystuff.tar"
cd /
/bin/tar -cvf $x path/to/backup
Now no messages at command line and it works fine. But still does not work in cron. I took the date thing out but I REALLY do need it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 02:49 PM
тАО02-20-2008 02:49 PM
Re: cron & tar
like it usually does for all my other cron jobs. It's just showing (root) RELOAD (cron/root)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 04:31 PM
тАО02-20-2008 04:31 PM
Re: cron & tar
Your initial example script works fine for me in cron (RHEL 4.6 ES, bash, vixie-cron-4.1-49.EL4).
I got a tar file that looks as expected and an email from cron (because output was not redirected):
Subject: Cron
/bin/tar: Removing leading `/' from member names
/home/myuserid/testdata/
/home/muuserid/testdata/miscfiles
... etc ...
So, I'm not sure what your specific issue is, but wanted to give some feedback so you can focus on things other than the script itself.
Jared Middleton
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 07:06 PM
тАО02-20-2008 07:06 PM
Re: cron & tar
Thanks for the feed back. I kind of thought the script was ok too. I didn't set this box up so there must be some funky cron setting that I am missing. At least I can rule the script out.
Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 07:39 PM
тАО02-20-2008 07:39 PM
Re: cron & tar
Is it a user-based crontab (i.e. crontab -u)? A system-based crontab (/etc/crontab, /etc/cron.d/
If it's the first two, check the 'MAILTO' environment variable.
If it's one of the last 3, then check the MAILTO variable in '/etc/crontab'.
If it's a user-based crontab, once again, the MAILTO variable in there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-20-2008 09:06 PM
тАО02-20-2008 09:06 PM
Re: cron & tar
First of all thanks for your input.
As you can see from my profile Iam
a HP-UX guy not a linux guy.
It turns out that my original script
would have worked but I was not
giving cron enough time to "reload".
That is when I was testing I would schedule
cron to execute the script about 2 minutes
after I edited the script. After hours of
googeling I re-edited my script to the original
and scheduled cron to run it 15 minutes later.
And guesss what...It worked. In HP-UX I allways
did a date command and then scheduled cron to execute
1 or 2 minutes later and it allways worked. But I
guess linux needs more time.
Silly me for wanting to test and being impatient.
Any comments are certinally welcome.
PS. I like to "bunny" all of my threads.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2008 09:19 AM
тАО02-21-2008 09:19 AM
SolutionFrom what I recall, cron checks for new crontabs AFTER each one minute iteration, so you do need to schedule at least 2 minutes out from the moment your crontab is saved... unless of course your job is set to execute EVERY minute (* * * * *).
Jared
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2008 11:53 AM
тАО02-21-2008 11:53 AM
Re: cron & tar
Linux server.domain.com 2.6.9-42.0.3.EL #1 Mon Sep 25 17:14:19 EDT 2006 i686 i686 i386 GNU/Linux
Whatever that translates to.