test1.sh
ping 114.114.114.114
test2.sh
ping 8.8.8.8
2. Edit crontab task by crontab -e command, and add the following contents:
*/1 * * * * /dd/shell/test1.sh
*/1 * * * * /dd/shell/test2.sh
After adding
, check the crontab content:
[root@localhost shell]# crontab -l
*/1 * * * * /dd/shell/test1.sh
*/1 * * * * /dd/shell/test2.sh
added crontab task, in /var/spool/cron directory will have a file named the current login account. Let’s say My login is root. A root file exists. The contents of this file are the crontab tasks that you just added.
[root @ localhost cron] # cat/var/spool/cron/root/1
* * * * */dd/shell/test1. Sh
* * * * */1/dd/shell/test2. Sh
p>
3. Delete test2.sh from crontab
is where sed is used to process the /var/spool/cron/root file and delete the line containing test2.sh.
sed -i '/test2.sh/d' /var/spool/cron/root
Crontab -l command after the
command.
[root@localhost shell]# crontab -l
*/1 * * * * /dd/shell/test1.sh
you can see that the task for test2.sh has been removed. Through observation, the steps of test2.sh are no longer performed. Indicates that the deletion was successful.
4. Delete crontab blank line
after executing the sed-i command above, crontab -l will see an extra line of white space. If you feel awkward, you can delete the blank line with the following command: sed.
sed -i '/^$/d' /var/spool/cron/root
p>
div>
Read More:
- Viewing crontab log of timed tasks in Linux
- Delete files with specified suffix in specified folder under Linux
- Linux_ day07_ 05_ Configure common add, delete, modify and query commands in network
- Docker delete error response from daemon: Conflict: unable to delete xxxxx solution
- On and off of timer in JS
- MP-BIOS bug: 8254 timer not connected to IO-APIC
- Matlab delete row or col to delete the row or column of the matrix
- Golang timer function executes a function every few minutes
- Several implementation methods of Python timing task
- JPA transaction problems executing an update / delete query
- Batch delete process
- Mac Windows partition merge and delete
- Mobile development: the error of “task failed with exit 1 signal 0 {…”
- Mobile development: prompt ‘Task failed with exit 1 signal 0 {…’ error
- Delete all content under vim
- Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’
- How can IntelliJ idea completely delete a project
- How to delete Microsoft AutoUpdate from Mac
- Error response from daemon: Conflict: unable to delete 8598c91556dc (must be forced)
- Gulp error report, assertionerror [err_ ASSERTION]: Task function must be specified