Page 1 of 2

corn scheduled tasks not autostarted

Posted: February 10th, 2011, 9:03 pm
by yoram
Hi
Following the instructions for scheduling tasks using corn ( I'm new to linux)
the tasks I place under CORN schedule never start up automaticall. Especially VNC.
If run manually, everything is OK. After reboot - nothing.
please help

thanks for a great site
yoram

Re: corn scheduled tasks not autostarted

Posted: February 10th, 2011, 9:21 pm
by Ian
Hi yoram

OK, this could be a few things, possibly permissions or possibly the way you've configured the cron job.

Are you using Wemin to configure the cron jobs? If so, what user are you running the jobs as? Can you type the following command in a putty session or a terminal and send me the output please?

Code: Select all

ls -l NameOfYourScript


You might need to include the full path of the script if it doesn't reside in the folder you're in.

Re: corn scheduled tasks not autostarted

Posted: February 15th, 2011, 8:32 pm
by yoram
hi

I run webmin under my user "yoram"
this is what I get from the ls -l

thanks, Yoram

yoram@CAROLINE:~/MyScripts$ ls -l StartVNC.sh
-rw-r--r-- 1 yoram yoram 128 2011-02-09 18:47 StartVNC.sh

Re: corn scheduled tasks not autostarted

Posted: February 15th, 2011, 9:08 pm
by Ian
Hi Yoram,

Ah, your script does not have execute permissions. So, issue the following command to fix:

Code: Select all

chmod a+x StartVNC.sh


then try again and let us know how you get on ;)

Re: corn scheduled tasks not autostarted

Posted: February 16th, 2011, 5:36 am
by yoram
Hi, It still doesn't work at startup
This is my command line from the corn: /home/yoram/MyScripts/StartVNC.sh >/dev/null
I've tried to put perl at the head without success

Thanks, Yoram

Re: corn scheduled tasks not autostarted

Posted: February 16th, 2011, 7:31 am
by Ian
OK, we need to delve a bit deeper........

Can you show me the script please:

Code: Select all

cat /home/yoram/MyScripts/StartVNC.sh


Also, please send me a screendump of the output from this command too:

Code: Select all

. /home/yoram/MyScripts/StartVNC.sh


What happens when you click the "Run Now" button on the Webmin screen for this script?

Re: corn scheduled tasks not autostarted

Posted: February 16th, 2011, 4:02 pm
by yoram
Hi
for the first command I got:

yoram@CAROLINE:~$
yoram@CAROLINE:~$ cat /home/yoram/MyScripts/StartVNC.sh
#!/bin/sh
echo "JOB RUN AT $(date)"
echo "============================"
echo ""
/usr/bin/vncserver -geometry 1024x768 -depth 24
yoram@CAROLINE:~$


and for the second:

yoram@CAROLINE:~$ . /home/yoram/MyScripts/StartVNC.sh
JOB RUN AT Wed Feb 16 17:58:07 IST 2011
============================


New 'CAROLINE:14 (yoram)' desktop is CAROLINE:14

Starting applications specified in /home/yoram/.vnc/xstartup
Log file is /home/yoram/.vnc/CAROLINE:14.log

yoram@CAROLINE:~$

When I try the "run now" a new session is created and I can access through VNC.

I found that if I put the script at the "system->preferences->startup applications" it would auto start
at power up (i.e at the ubuntu home screen)

Yoram

Re: corn scheduled tasks not autostarted

Posted: February 16th, 2011, 9:19 pm
by Marco
Hi guys,

@Yoram

Issue the following two commands and send us the output:

Code: Select all

sudo cat /var/spool/cron/crontabs/yoram


Code: Select all

sudo cat /var/spool/cron/crontabs/root


cheers

Marco.

Re: corn scheduled tasks not autostarted

Posted: February 16th, 2011, 10:30 pm
by yoram
Hi Marco, thanks for your help

here it is
1. for Yoram
login as: yoram
yoram@192.168.0.14's password:
Linux CAROLINE 2.6.35-25-generic-pae #44-Ubuntu SMP Fri Jan 21 19:01:46 UTC 2011 i686 GNU/Linux
Ubuntu 10.10

Welcome to Ubuntu!
* Documentation: https://help.ubuntu.com/
Last login: Wed Feb 16 22:14:38 2011 from 192.168.0.10
yoram@CAROLINE:~$ sudo cat /var/spool/cron/crontabs/yoram
[sudo] password for yoram:
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.UbuosB/crontab installed on Wed Feb 16 07:29:33 2011)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
@hourly /home/yoram/MyScripts/StartVNC.sh >/dev/null #Autostart VNC server
yoram@CAROLINE:~$



2. for root
login as: yoram
yoram@192.168.0.14's password:
Linux CAROLINE 2.6.35-25-generic-pae #44-Ubuntu SMP Fri Jan 21 19:01:46 UTC 2011 i686 GNU/Linux
Ubuntu 10.10

Welcome to Ubuntu!
* Documentation: https://help.ubuntu.com/
Last login: Thu Feb 17 00:24:18 2011 from 192.168.0.10
yoram@CAROLINE:~$ sudo cat /var/spool/cron/crontabs/root
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.LwjbsC/crontab installed on Thu Feb 10 20:54:33 2011)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
yoram@CAROLINE:~$


3. There is some permissions issue with my installation.
I activated SAMBA and enabled writes but when accessed from windows (with the owner user "yoram")
I got "access denied" whenever trying to write to the shared directory

Thanks again
Yoram :)

Re: corn scheduled tasks not autostarted

Posted: February 16th, 2011, 10:46 pm
by Ian
Nice call Marco, you've cracked it. :clap:

Yoram, your StartVNC.sh script is set to fire hourly, not on system boot. This is why you had 14 virtual desktops when you posted those screenshots. :eek:

@hourly /home/yoram/MyScripts/StartVNC.sh >/dev/null #Autostart VNC server

Go into Webmin and change the "Simple schedule" drop down to read "When system boots" for that cron job. Then click Save.

With your samba problems, in Webmin go into the share and click the "Security and Access Control" icon. Then the option at the top, Writable? Yes No" needs to be changed to Yes. Then click Save and try again.

Also send us a screenshot of the folder(s) you're trying to write to:

ls -l /folderyouaretryingtowriteto


Let us know how you get on :thumbup: