第一种方法:

/etc/init.d   #在init.d 下创建脚本

脚本格式:必须添加这2行否则无法添加

#!/bin/bash

#chkconfig: 2345 81 96

#description:Starttomcat
......
添加权限:
chmod 777 test.sh
执行添加:
chkconfig --add /etc/init.d/test.sh
检查:
chkconfig

 

 

第二种方法:

crontab -e
@reboot /home/start.sh

@reboot  表示开机后执行 

posted on 2022-12-30 11:12  属于我的梦,明明还在  阅读(155)  评论(0)    收藏  举报