Script description
freeCache
To write the shell
script and store it in the /usr/local/bin
directory, this article uses the freeCache
script example to create a freeCache
scheduled task that executes the script every 10 minutes .
Set up freeCache
scheduled tasks
_set_freeCache(){
echo "*/10 * * * * root /usr/local/bin/freeCache" >> /var/spool/cron/root
}
Delete freeCache
scheduled task
_del_freeCache(){
sed "/freeCache/d" /var/spool/cron/root > /tmp/root.tmp
mv -f /tmp/root.tmp /var/spool/cron/root
}
Other related commands
- View crontab log
tail -f /var/log/cron
- View the created tasks
crontab -l