只需要在/etc/rc.local里添加你的程序即可,例如需要nginx服务在每次开机时自动运行则可以加入如下的配置,添加最后一行/usr/local/nginx/sbin/nginx即可
#!/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
/usr/local/nginx/sbin/nginx
设置环境变量
如果使用的是bash外壳,则键入如下命令:
JAVA_HOME=/ path/ to/ jdk
export JAVA_HOME
其中/path/to/jdk是安装Java的路径。
如果使用的是tcsh,则键入如下命令:
setenv JAVA_HOME /path/to/jdk
删除环境变量
字符模式下设置/删除环境变量
bash下
设置:export 变量名=变量值
删除:unset 变量名