设置开机启动时指定非ROOT用户执行相应的脚本

时间:2023-03-08 19:37:31
设置开机启动时指定非ROOT用户执行相应的脚本
 [root@MSJTVL-MJSP-A01 sm01]# vim /etc/rc.d/rc.local

 #!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff. touch /var/lock/subsys/local
su tomcat -c "/opt/tomcat/start.sh" --把要执行的命令作为一个参数传递级su

启动时指定非ROOT用户执行相应的脚本。