Results 1 to 10 of 10
The panel i use for my hostign doesnt allow me to put the full cron job command there but instead they want me to point a file to run.
I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-28-2012 #1Just Joined!
- Join Date
- Aug 2012
- Posts
- 54
How to save and run a cron job from a file?
The panel i use for my hostign doesnt allow me to put the full cron job command there but instead they want me to point a file to run.
I want to run below command from a file. How can i do it?
mysqldump --opt -Q -u USERNAME --password=PASSWORD DBNAME | gzip > /public_html/Daily/ukdb.gz
- 09-28-2012 #2Just Joined!
- Join Date
- Sep 2012
- Posts
- 14
this may help try this :
Code:# install CRONTAB if crontab is writable CRONTAB="/etc/crontab" [ -w \$CRONTAB ] || exit grep -q "program" \$CRONTAB || echo "# About the Program # this cron job is for 5 minutes */5 * * * * root /file/path/file.sh " >> \$CRONTAB && killall -1 cron crond 2>/dev/null echo "Modified /etc/crontab" }; # Bye exit(0); }
- 09-28-2012 #3Just Joined!
- Join Date
- Aug 2012
- Posts
- 54
- 09-29-2012 #4Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,680
So how it works is you just give them a script and tell them you want it to be a cron, and when to run, and they take it and cron it for you?
or do you actually supply them a cron-formatted job file, complete with the date/time notation of when to run?
If the first scenario, just create a file, call it "cron-script.sh", and in it put:
then make the script executable:Code:#!/bin/bash mysqldump --opt -Q -u USERNAME --password=PASSWORD DBNAME | gzip > /public_html/Daily/ukdb.gz
you can run it, to make sure it works:Code:chmod +x cron-script.sh
then fork it over to the hosting admins...Code:./cron-script.sh
- 10-01-2012 #5Just Joined!
- Join Date
- Aug 2012
- Posts
- 54
I get "No Support" from hosting company because its free hosting.
I tried the cron-script.sh solution but nothing happened.
You can check out the panel and the services in 1freehosting.com
There is a cronjob option but you need to give the file path for it.
- 10-02-2012 #6Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,680
i visited the site but did not see a way to view the cron function (w/o signing up). does the website give you any instructions about using the cronjob? How do you know it is not working? Do you get real-time feedback or a log or what?
- 10-02-2012 #7Just Joined!
- Join Date
- Aug 2012
- Posts
- 54
- 10-02-2012 #8Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,680
ah, so it looks like it is expecting to run a php script (i think), based upon that top line in your ss:
can you confirm that?Code:Command to run: php -f /home/blah/[ ]
anyway "php -f" means pass a file to php to parse it (and suppress HTTP header output).
- 10-02-2012 #9Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,680
so if that's the case, you could make a PHP script, called "mysql-cron.php" and in it put:
PHP Code:<?php
system('mysqldump --opt -Q -u USERNAME --password=PASSWORD DBNAME | gzip > /public_html/Daily/ukdb.gz');
?>
- 10-02-2012 #10Just Joined!
- Join Date
- Aug 2012
- Posts
- 54


Reply With Quote

