![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Linux Support Linux - Operating Systems and Applications Support |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Oct 2008
Posts: 1
OS: Linux
|
running scripts under cron
I'm having an issue with a couple of scripts under cron. I did not write these scripts, but they do work when manually ran. They basically are used to decrypt pgp files we receive daily and then move the decrypted files to another location.
This is the first script: cd /home/xxxxxx ls -A1 *.pgp | sed 's/^/\/opt\/bin\/test2.sh /' >> /opt/bin/sed.txt chmod 777 /opt/bin/sed.txt /opt/bin/sed.txt rm /opt/bin/sed.txt mv /home/xxxxxx/*.pgp /home/xxxxx/archive chown xxxxx /home/pcard/*.cdf chgrp ftp /home/xxxxx/*.cdf date >> /opt/bin/date.sed This is the second script that runs within the first: /usr/bin/gpg --passphrase-fd 0 --yes -o /home/xxxxx/`echo $1 | sed 's/.pgp//g'` /home/xxxxx/`echo $1` << EOF xxxxxxx EOF So I am looking for any suggestions that may help me get these running under cron once again. Last edited by AegidiusAK; 10-21-2008 at 01:14 PM. |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Registered User
Join Date: Oct 2007
Location: Littleton, Colorado USA
Posts: 470
OS: xp 64 sp2 Fedora Core 8 (vmware xp core 8 x32) Minix
|
Re: running scripts under cron
First. Do they still run. If you run the second script will it, without error run the first script? Your post says it will. Does it run without asking for any input, like a passphrase? So if the second scripts name is "second.sh", does it successfully run if you type in "/usr/local/bin/second.sh". My example will email the output results to you.
(I would add a line to each script as the first line "#!/bin/bash". That way the script executing subsystem will invoke the bash shell. If you want the "sh shell" then make the first line "#!/bin/sh". Drop the quotes around #!/bin/sh.) 0 */3 * * * (cd /opt/xxxx; /xxx/yyy/second.sh -q 2>&1 | mail -s "cron backup output" your-user-name) You will have to do a "man 5 crontab" to get the meaning of the asterisk fields. In this example the program will be run every 3 hours. The granularity of a job being kicked off is every minute. This example runs every minute: * * * * * /usr/local/bin/keepalive.sh 2>&1 /dev/null It runs a keep alive script that attempts to keep my comcast.net link up. You need to edit your crontab or become "root" to edit a privileged cron. Just run "crontab -e". Reassign the environment variable EDITOR to your favorite editor, otherwise it defaults to "vi". Cron can run under any user including root. You will have to su to the user you want to install the cron for. Also for debugging, set the time interval for every minute, all asterisks, so the errors can be traced. My systems also write cron output to /var/log/cron, though errors are not written to this file, only errors from the cron program itself. |
|
|
|
![]() |
| Thread Tools | |
|
|