嵌入式学习-飞凌ElfBoard ELF 1板卡-通过shell脚本添加定时任务
其他
1590 人阅读
|
0 人回复
|
2024-03-14
|
|
1.新建jiaoben.sh脚本
root@ELF1:~# touch jiaoben.sh
root@ELF1:~# ls
elf1_audio.mp3 elf1_audio.wav jiaoben.sh
脚本内容
#!/bin/bash
while true
do
/home/root/test.sh
sleep 60
done
2.新建test.sh脚本
root@ELF1:~# touch test.sh
root@ELF1:~# ls
elf1_audio.mp3 elf1_audio.wav jiaoben.sh test.sh
脚本内容
#!/bin/bash
echo "hello world" >> /home/root/a.txt
3.赋予脚本权限
root@ELF1:~# chmod 777 jiaoben.sh test.sh
4.添加jiaoben.sh到开机自启脚本中
root@ELF1:~# vi /etc/rc.local
添加内容
/home/root/jiaoben.sh &
5.保存重启开发板
root@ELF1:~# sync
root@ELF1:~# reboot
6.查看a.txt
root@ELF1:~# vi a.txt
每分钟执行一次test.sh脚本,并输出hello world到a.txt中。
|
|
|
|
|
|
|
|
|