This article is a mirror article of machine translation, please click here to jump to the original article.

View: 1|Reply: 0

[linux] Linux Tutorial on Timed Tasks Based on Systemd Timer

[Copy link]
Posted on40 seconds ago | | | |
Requirements: Our commonly used Linux scheduled task is the crond service, but we don't know that there is another timing method, that is, systemd, we often use systemd to manage our services, but we don't know that we can also set scheduled tasks through systemd.

review
Linux systemd service manager explained in detail
https://www.itsvse.com/thread-10178-1-1.html

Service unit

Create a new test1.service file, which is the specific task we are performing, and the configuration is as follows:
Timer unit

The service unit simply defines how the task is executed, and to schedule this service, the Timer unit must also be defined. Create a new test1.timer file with the following configuration:
Upload the test1.service and test1.timer files to the server/etc/systemd/systemfolder. Run the following command:
As shown below:



View the execution log:




Previous:Cannot run program "sh": error=13, Permission denied
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com