Linux: Delay at command, permanent crontab command, and clean up temporary file junk

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


Create a user first

Blacklist: /etc/at.deny

Edit file content:

Whitelist: touch /etc/at.allow

       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


Permanent whitelist: touch /etc/cron.allow

                   vim /etc/cron.allow


Method 2:
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:


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325448979&siteId=291194637