2017-01-10 57 views
0

每天我想運行一個腳本並檢查一些條件,並根據這些條件,我想要插入數據到數據庫中。如何在Justhost中實現Cronjob?

我正在使用Cron-Job(控制器)來自動執行此過程。 在我自動化的腳本文件(即Controller)中,我試圖加載'view'文件(腳本)。只有控制器正在執行,而不是「視圖」文件,即數據沒有被插入數據庫。

這是我第一次使用Cron-Jobs,請指導我完成。

* * * * * php /home/<cpanel_username>/public_html/index.php Controller_name 

CodeIgniter框架(3.1)/ PHP(5.6)。

主機服務器:Justhost(cPanel 2.2)。

回答

1

請找到執行cronjob的方式。作業定義的

例子:

.---------------- minute (0 - 59) 
| 
.------------- hour (0 - 23) 
| 
| .---------- day of month (1 - 31) 
| 
| | .------- month (1 - 12) OR jan,feb,mar,apr ... 
| 
| | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat 
| 
| | | | 

* * * * * command to be executed 
+0

鏈接到手動評論就足夠了。 –

+0

@Kamlesh請分享一個例子。 – Raham

+0

@Raham我已經上傳了一個例子。在那裏我每隔一天就設置一次cron job。你能檢查一下嗎? – Kamlesh

1

能否請您找到下面的例子。

這是我已經使用了每1天

crontab -e 

地址:

0 0 * * 1 your/command