如何在后台自动 运行 一个 bash 脚本?
how to run a bash script in background automatically?
我需要编写一个 bash 脚本来自动删除临时文件,并每天在后台运行。
#!/bin/bash
while true;
do
rm /home/c/temp/*
sleep 24h
done
但是没用
写一个shell脚本
rm /home/c/temp/*
并在 crontab 中添加一行
crontab -e
添加行
0 12 * * * path/to/script
它会在每天中午执行你的脚本。
我需要编写一个 bash 脚本来自动删除临时文件,并每天在后台运行。
#!/bin/bash
while true;
do
rm /home/c/temp/*
sleep 24h
done
但是没用
写一个shell脚本
rm /home/c/temp/*
并在 crontab 中添加一行
crontab -e
添加行
0 12 * * * path/to/script
它会在每天中午执行你的脚本。