#!/bin/bash #chkconfig: 22345 10 90 #description: Start and Stop redis #端口 REDISPORT=6379 #server:/usr/local/redis/redis-6.2.7/src/redis-server EXEC=/usr/local/redis/bin/redis-server #/usr/local/redis/redis-6.2.7/src/redis-cli CLIEXEC=/usr/local/redis/bin/redis-cli #密码 REDISPWD=123456 #该文件路径可从conf文件中找 PIDFILE=/var/run/redis_6379.pid #conf路径 CONF=/usr/local/redis/etc/redis.conf case "$1" in start) if [ -f $PIDFILE ];then echo "$PIDFILE exists,process is already running or crashed" else echo "Starting Redis server..." $EXEC $CONF fi ;; stop) if [ ! -f $PIDFILE ];then echo "$PIDFILE does not exist,process is not running" else PID=$(cat $PIDFILE) echo "Stopping..." $CLIEXEC -p $REDISPORT -a $REDISPWD shutdown while [ -x /proc/${PID} ] do echo "Waiting for Redis to shutdown..." sleep 1 done echo "Redis stopped" fi ;; restart) "$0" stop sleep 3 "$0" start ;; *) echo "Please use start or stop or restart as first argument" ;; esac
cd /etc/init.d ./redis start ./redis stop ps -ef|grep redis
chkconfig --add /etc/init.d/redis chkconfig redis on
如果没有root身份下执行以下命令 cd $ORACLE_HOME ./root.sh
cd $ORACLE_HOME cd bin/ #编辑dbstart以及dushut文件 ORACLE_HOME_LISTNER=$1修改成 ORACLE_HOME_LISTNER=$ORACLE_HOME,前提是$ORACLE_HOME环境设置正确:
vi /etc/oratab 将orcl:/u01/app/oracle/product/11.2.0/dbhome_1:N 修改成 orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y 注意:orcl为数据库实例名
vi /etc/rc.d/rc.local #touch /var/lock/subsys/local下加入如下内容(修改成自己的oracle路径) su oracle -lc "/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start" su oracle -lc /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
chmod 777 /etc/rc.d/rc.local cd /etc/rc.d/ #看看rc.local变为绿色 ll
#重启 reboot #连接 sqlplus / as sysdba #查看状态 select status from v$instance; #退出 quit #查看监听状态 lsnrctl status
#!/bin/bash #chkconfig:2345 10 90 #description:resind cd /home/sgxy/mpms nohup ./01-startAdministratorLogic.sh > nohup01.out & nohup ./02-startUapServerLogic.sh > nohup02.out & port_status=`netstat -nlt|grep 9003|wc -l` sleep 10 if [ $port_status -lt 1 ]; then echo "succeed" nohup ./03-startMpms.sh > nohup03.out & nohup ./04-startDamr.sh > nohup04.out & cd /home/sgxy/mpms/other_jar/dtu nohup java -jar DtuDataServer.jar > catalina.out 2>&1 & else echo "filed" fi
以下内容中必须填写
chkconfig:2345 10 90
description:resind
然后把该文件放到/etc/rc.d/init.d目录下,redis开机自启动第七步再来一遍
reboot ps -ef | grep 'java'
通过shell脚本运行jar包报错运行如下命令,建立软连接
echo $JAVA_HOME #复制路径:/home/local/java/jdk1.8.0_301 cd /usr/bin ln -s -f /home/local/java/jdk1.8.0_301/bin/java