简体   繁体   中英

Run cron job in cpanel

Of-course, this is one similar question. But i tried with many solutions. Still i couldn't make it right.

I need to setup cron job in CPanel. Following is the command, which i gave to run cron job.

wget -O /dev/null http://www.domainname.com?import_key=-lIkUvA-r&import_id=4&action=trigger > /dev/null 2>&1

wget -O /dev/null http://www.domainname.com?import_key=-lIkUvA-r&import_id=4&action=processing > /dev/null 2>&1

But it is not working and also i need to execute mysql query accordingly in the same panel.

This is the command which i set to run the cron job.

mysql -u username -p password db_name < /home/user/cron.sql

But it is not working. Can any one please give an idea / suggestions? How to run cron job in cpanel?

First make sure your hosting is running a linux machine, because these commands are not windows compatible.

If you have ssh access then try to run this command :

$ which wget

This will give you the full path of wget if it is installed. Using that path you can modify your cron to be something like :

/full/path/to/wget -O /dev/null http://www.domainname.com?import_key=-lIkUvA-r&import_id=4&action=trigger > /dev/null 2>&1

/full/path/to/wget -O /dev/null http://www.domainname.com?import_key=-lIkUvA-r&import_id=4&action=processing > /dev/null 2>&1

To run mysql queries from bash :

mysql --user=username --password=password --database=database --execute="SELECT * FROM mytable;"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM