, use the AT command to set a one time scheduled task
2. Use crontab to set up periodic scheduled tasks
1) cd/home directory, use VI test.py to create the file, the content is as follows:
#!/usr/bin/python
#coding =utf-8
Import time
F=open (' F.txt ', ' W ')
now = Time.strftime ('%y-%m-%d-%h_%m_%s ', Time.localtime (Time.time ()))
F.write (' File run time: ' +now+ ' \ n ')
F.close ()
2) Edit the crontab file using the CRONTAB-E command
Minutes Hours Day Month Week command/script path (absolute path)
5 * * * * python/home/test.py
After completing the crontab task creation, the interface prompts you as follows:
[Email protected] home]# CRONTAB-E
No crontab for root-using an empty one
Crontab:installing New Crontab
3) Start the crontab service:
Note: After you finish editing, to restart the cron process, crontab service operation instructions:
~#/etc/init.d/cron Restart//Restart service
~#/etc/init.d/cron Start//Startup service
~#/etc/init.d/cron Stop//Shutdown service
~#/etc/init.d/cron Reload//Reload Configuration
Linux System timer task settings