Caution (注意)
This script carries potential risks. Only run it on test systems where you can open new terminal sessions with root access at any time, and that can be rebooted anytime without impacting business operations!
此脚本可能会带来风险,请只在可随时增加新的可切换到 root 用户的终端命令行窗口,且可随时重启,重启绝对不会影响业务的测试系统上使用!
介绍
基本信息
作者:朱明宇
名称:创建 1 个无法被中断的永远运行的前台进程
作用:创建 1 个无法被中断的永远运行的前台进程,除非关机、重启系统或者重新开 1 个终端在那个终端使用 kill 命令结束这个进程
使用方法
1. 给此脚本添加执行权限
2. 执行此脚本
Note (注意)
The way to abort this script is to shut down, restart the system, or restart a terminal. Use the kill command on that terminal to end the process
中止此脚本运行的方式是:关机、重启系统或者重新开 1 个终端在那个终端使用 kill 命令结束这个进程
脚本
#!/bin/bash
trap 'echo ;echo -e "\033[35m你杀不死我的,没有人可以杀死我,哇哈哈!";sleep 5;
for i in {1..10}
do
echo -e "\033[34m我又开始运行了,哇哈哈!\033[0m"
sleep 0.5
done ;sleep 2' 2
while :
do
for i in `seq 1 3`
do
echo -en "\033[3$[i]m我将会永远运行,哇哈哈! \033[0m"
sleep 0.2
done
echo
done
