1. Delay task
at command (temporarily)
at now+3min
monitor first: watch -n 1 ls /mnt/ -l
at 16:00
>touch /min/file{1..4}
>ctrl+d
at -l View task number
at -c 3 3: number
at -c view the content of the task
at -r delete
at -r 3
method one:
minute hour day month week
* * * * *
* 08-17 * * *
*/2 08-17 * * *
*/2 08-17 1, 15 * *
*/2 08- 17 1, 15 3-5 3
crontab -u root -e Initiate a task
crontab -u root -l View
crontab -u root -r Delete a task
For example :
crontab -u root -e
08 22 * * * rm -fr /mnt/ The input after file is the command to be executed
cd /etc/cron.d
touch linux
vim linux
* * * * * root touch /mnt/linux{1..5}
cat westos to view, cannot be viewed with crontab -l
2. Empty temporary file garbage
cd /usr /lib/tmpfiles.d switch environment
vim westos.conf
d /mnt/westos 1777 root root 5s
type name permission user group existence time
systemd-tmpfiles --create /usr/lib/tmpfiles.d/* create
touch /mnt/westos /file
at command (temporarily)
at now+3min
monitor first: watch -n 1 ls /mnt/ -l
at 16:00
>touch /min/file{1..4}
>ctrl+d
at -l View task number
at -c 3 3: number
at -c view the content of the task
at -r delete
at -r 3
Blacklist: /etc/at.deny
Edit file content:
vim /etc/at.allow (whitelist appears, blacklist is invalid, only root user can do it)
Edit file content:
Only superuser can run when there is no user in the whitelist
Edit file content:
crontab command (permanent)method one:
minute hour day month week
* * * * *
* 08-17 * * *
*/2 08-17 * * *
*/2 08-17 1, 15 * *
*/2 08- 17 1, 15 3-5 3
crontab -u root -e Initiate a task
crontab -u root -l View
crontab -u root -r Delete a task
For example :
crontab -u root -e
08 22 * * * rm -fr /mnt/ The input after file is the command to be executed
Permanent blacklist: vim /etc/cron.deny
vim /etc/cron.allow
cd /etc/cron.d
touch linux
vim linux
* * * * * root touch /mnt/linux{1..5}
cat westos to view, cannot be viewed with crontab -l
2. Empty temporary file garbage
cd /usr /lib/tmpfiles.d switch environment
vim westos.conf
d /mnt/westos 1777 root root 5s
type name permission user group existence time
systemd-tmpfiles --create /usr/lib/tmpfiles.d/* create
touch /mnt/westos /file
systemd-tmpfiles --clean /usr/lib/tmpfiles.d/* clean
Edit file content: