XFileSharing Pro - I need clarification about crontab

Message
Author
RockDiz
Posts: 135
Joined: May 05, 2011 4:47 pm

I need clarification about crontab

#1 Postby RockDiz » Aug 22, 2012 7:05 am

Alright, as quoted from the install file:
8 ) Add cron.pl script to your crontab to run it every hour, cron_deleted_email.pl to run every day.
Sample:
0 * * * * cd /var/www/cgi-bin;./cron.pl >/dev/null 2>&1
0 0 * * * cd /var/www/cgi-bin;./cron_deleted_email.pl >/dev/null 2>&1
I've ran "cd /var/www/cgi-bin" in putty but it didn't work, instead I would get this error message
"-bash: cd: /var/www/cgi-bin: No such file or directory"

but I've ran "./cron.pl >/dev/null 2>&1" and it worked :D

so I was wondering, in the crontab do I just insert "./cron.pl >/dev/null 2>&1" for command or is it necessary to insert "cd /var/www/cgi-bin;./cron.pl >/dev/null 2>&1"??

It's the same scenario with "cd /var/www/cgi-bin;./cron_deleted_email.pl >/dev/null 2>&1"

"./cron_deleted_email.pl >/dev/null 2>&1" works but again, do insert "./cron_deleted_email.pl >/dev/null 2>&1" into command for crontab or I have to put both "cd /var/www/cgi-bin;./cron_deleted_email.pl >/dev/null 2>&1"?

thanks!

RockDiz
Posts: 135
Joined: May 05, 2011 4:47 pm

#2 Postby RockDiz » Aug 22, 2012 7:07 am

Oh!! and also,

do i need to only add the cronjob to the Main File server? or the Main File server and all my Additional File servers?

Thanks in advanced!

stdio
Posts: 65
Joined: Mar 27, 2012 4:05 pm

#3 Postby stdio » Aug 22, 2012 10:27 am

cd /var/www/cgi-bin;./cron.pl was an example only. You need to change the path to your cgi-bin folder (where your site is located). If you are using cpanel it should be /home/username/public_html/cgi-bin. :)

RockDiz
Posts: 135
Joined: May 05, 2011 4:47 pm

#4 Postby RockDiz » Aug 22, 2012 4:33 pm

stdio wrote:cd /var/www/cgi-bin;./cron.pl was an example only. You need to change the path to your cgi-bin folder (where your site is located). If you are using cpanel it should be /home/username/public_html/cgi-bin. :)

alright, so the first command would be:
cd /home/user/public_html/cgi-bin;./cron.pl >/dev/null 2>&1
and the other:
cd /home/user/public_html/cgi-bin;./cron_deleted_email.pl >/dev/null 2>&1
does that also mean I no longer need to run cron.pl under Special Functions on admin_servers page?

Thanks

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#5 Postby PowerChaos » Aug 23, 2012 12:00 am

lets try to explain it a little easyer to prevent confusion

Code: Select all

cd /var/www/cgi-bin
cd = to open a directory
/var/www = change this to your home directory ( /usr/local , /home/username and so on )

if you do not know your homedirectory , please ask some1 to do the crontab instalation for you

as alternative you can try to find the www folder aka the folder where you uploaded your webserver files to ( like /home/website )

cgi-bin = cgi-bin or the location where you got the file called index.cgi in

those are examples , we do not know what your home directory is and if you do not know what your home directory is then you need to ask some1 to do it for you

the final solution if you can SSH to your server is by running this command

Code: Select all

locate index.cgi
or

Code: Select all

sudo locate index.cgi
that will show the exact location of index.cgi and your homedirectory like this

Code: Select all

/home/website/www/cgi-bin/index.cgi
the homedirectory in this example is /home/website/www

Greetings From PowerChaos