Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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'm having some issue when executing script via cron
the script run fine when i run it manually
./scriptname.sh & takes around 10min
but when it executed from cron seems it's not running properly.
We have echo like "job starting at " & "job ending at"
From the logfile I can see that the echo command is executed but
not other commands in between.
starting & ending time is same (or 1sec diff) but actually it should take 10min.
I'm not able to capture terminal message written by this script.
when run manually 'script' command work ( thogh no issue when run manually).
I can't include 'script' command in this script as I'm not able to pass ctrl+D/exit to terminate it.
The devloper who actually write this script ( with TGIT command) couldn't help me much.
(It's a housekeeping job)
Could someone please help me to find the possible cause of this ?
Is there any way to capture the terminal message in log file when the script run which possibly can help
to see errors? ( job run at midnight when no one available at office)
NB: when I run manually first time - it initially showing dir not found - though mentioned path inside script was correct.
Then I create new .sh script by vi & copy same commands again & then it execute in newly created script without any issue.not sure about the reason.
echo "starting script ... at `date` " >> /scripts/git/log/`date +20%y%m%d`_repack.log
cd /home/gitadmlocal/repositories/ILP/CoreProduct.git
< git command writed by developer -- which is not doing anything when run from cron>
echo "Ending script after running... at `date` " >> /scripts/git/log/`date +20%y%m%d`_repack.log
Housekeeping command working when run the script manually
./repack.sh
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.