Results 1 to 9 of 9
Hey.
I have cron jobs running to update client activity every ten minutes and a dashboard update each day at 11am.
When there is a SSH connection into the server ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-08-2013 #1Just Joined!
- Join Date
- Jan 2013
- Posts
- 6
Cron not running when not logged in. Ubuntu Server
Hey.
I have cron jobs running to update client activity every ten minutes and a dashboard update each day at 11am.
When there is a SSH connection into the server the scripts and cron jobs run fine.
However when I am not logged into said server via SSH the cron jobs do not run.
I have checked to ensure that the scripts are not in an encrypted home directory. Which they are not.
As a workaround I have a machine logged in 24/7 to ensure data updates. But I need to solve the issue.
Any pointers and tips on how to start resolving this issue?
Thanks,
Alan.
- 01-08-2013 #2
Hi and welcome
There is no obvious connection between cronjobs and a ssh session.
- Do you maybe enable <whatever> ressorce in e.g. ~/.profile, ~/.bash_profile etc?
- Can you explain or show these cron scripts in CODE tags?
- Do the crons work, if you are logged in locally via direct access to the machine or an out-of-band mechanism?You must always face the curtain with a bow.
- 01-08-2013 #3Just Joined!
- Join Date
- Jan 2013
- Posts
- 6
Well sorry the SSH was just to explain I am remoted into the machine so it is accessed. However direct local logon is not possible this server is one of the clients on my ESXi server.
Cron set-up:
Code:# m h dom mon dow command 0 5 * * * /bin/sh /home/ubuntu/alan/removesuccess.sh 0 11 * * * /bin/sh /home/ubuntu/alan/dash.sh > success.txt */10 * * * * /bin/sh /var/www/tracker/tracker.sh */5 * * * * /bin/sh /home/ubuntu/alan/test.sh 5 11 * * * /bin/sh /home/ubuntu/alan/success.sh
- 01-08-2013 #4Just Joined!
- Join Date
- Jan 2013
- Posts
- 6
tracker.sh is as follows:
Code:echo "Client Activity Tracker" echo "" #Version1 Alan Lumley ruby /var/www/tracker/callGordon.rb echo "" touch tracking.txt echo "Script completed" > tracking.txt
- 01-09-2013 #5
- 01-09-2013 #6
Change the file permission of all the above .sh scripts to 755. Next, login as "ubuntu" user and edit the crontab in the following fashion (only after making scripts with 755 permission)
0 5 * * * /home/ubuntu/alan/removesuccess.sh
or
0 5 * * * /home/ubuntu/alan/./removesuccess.sh (yes, ./removesuccess.sh at the end)
This will execute the script even if u logoff as ubuntu
Of course the cron will fail when u execute the 3rd cron job in your list unless ubuntu has permission over /var/www/tracker directory.
Hope this helps.
Jazak Allah
Sohail
- 01-09-2013 #7Just Joined!
- Join Date
- Jan 2013
- Posts
- 6
- 01-10-2013 #8
Thanks lumlevmedia and the name is Sohail, not Jazak
Even if the cron jobs are from root user, I would still recommend you to change the file permissions of scripts to 755 and follow the cron job format i mentioned in my previous post.
Things should work out great.
Jazak Allah,
Sohail
- 01-10-2013 #9Just Joined!
- Join Date
- Jan 2013
- Posts
- 6


Reply With Quote

