Сервер Red Hat Linux 7.3, Red Hat Linux 9.0
Прочие настройки сервера elis.it.ru, grossb.it.ru (mts, sos)
Остановка сервера через login:
Конфигурационный файл /etc/passwd
[root@elis /root]# less /etc/passwd ====== cut ======== shutdown:x:0:0:shutdown:/sbin:/sbin/shutdown +1 -h halt:x:0:0:halt:/sbin:/sbin/shutdown +0 -h nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin ====== cut ========не помешает сделать следующее (указать, что файл будет запускаться с правами root-а):
[root@elis /root]#chmod ug+s /sbin/shutdown
Скрипт добавления пользователя к задаче Price
[root@elis /root]# less /usr/local/bin/useraddprice #!/bin/bash # Add User for Price task TAB=$1 if [ ${#TAB} != 8 ]; then # echo "$TAB less or more that 8" # echo "" echo "usage: useraddprice tabno" echo " adduserprice tabno" echo "" echo " tabno - 8 digits" exit 1 fi TABDIR=/data/tasks/tabs DIR1=${TAB:0:2} DIR2=${TAB:5:3} TABNAME=tab$TAB HOMEDIR=/home/elis if [ ! -d $TABDIR ]; then echo "Make directory $TABDIR" /bin/mkdir $TABDIR; else echo "Directory $TABDIR already exist" fi if [ ! -d $TABDIR/$DIR1/$TAB/$DIR2 ]; then echo "Make directory $TABDIR/$DIR1/$TAB/$DIR2" /bin/mkdir -p $TABDIR/$DIR1/$TAB/$DIR2 else echo "Directory $TABDIR/$DIR1/$TAB/$DIR2 already exist" fi /bin/chmod 750 -R $TABDIR/$DIR1/$TAB/ /bin/echo "Add User $TAB for Price task" /usr/sbin/useradd $TABNAME -g elis -d $HOMEDIR -s /sbin/nologin -p 1234567 /usr/bin/passwd -d $TABNAME /usr/bin/smbpasswd -a $TABNAME 1234567 /usr/bin/smbpasswd -n $TABNAME if [ -d $TABDIR/$DIR1/$TAB ]; then cd $TABDIR/$DIR1/$TAB echo "Current Directory is $PWD" printf "IF NOT EXIST z:\%bbin\z32.exe net use z: \%b\%bgrossb.it.ru\%btasks\n" >z32.bat printf "z:\%bbin\%bz32.exe -h z:\%bhome_l @TAB $TAB\n" >> z32.bat printf "" >> z32.bat fi if [ -d $TABDIR/$DIR1/$TAB/$DIR2 ]; then cd $TABDIR/$DIR1/$TAB/$DIR2 echo "Current Directory is $PWD" printf "IF NOT EXIST z:\%bbin\z32.exe net use z: \%b\%bgrossb.it.ru\%btasks\n" >z32cen.bat printf "z:\%bbin\%bz32.exe -h z:\%bhome_cen @TAB $TAB\n" >> z32cen.bat printf "" >> z32cen.bat fi echo "Recursive change owner for new User Directorys: $TABDIR/$DIR1/$TAB/" /bin/chown $TABNAME -R $TABDIR/$DIR1/$TAB/ echo "Recursive change group for new User Directorys: $TABDIR/$DIR1/$TAB/" /bin/chgrp elis -R $TABDIR/$DIR1/$TAB/ echo "Recursive change mode for new User Directorys: $TABDIR/$DIR1/$TAB/" /bin/chmod u+rw -R $TABDIR/$DIR1/$TAB/ /bin/chmod g+r -R $TABDIR/$DIR1/$TAB/ /bin/chmod o-rwx -R $TABDIR/$DIR1/$TAB/
Сервис сервера (автозагрузка)
Конфигурационный файл /etc/init.d/zserv (elis)
[root@elis /root]# less /etc/rc.d/init.d/zserv #! /bin/sh # zserv This is the init script for starting up the ZSERV # server # # chkconfig: 345 85 15 # description: Starts and stops the ZSERV daemon that handles \ # all database requests. # processname: zserv # pidfile: /var/run/zserv.pid # # Source function library. . /etc/rc.d/init.d/functions # Get config. . /etc/sysconfig/network # Check that networking is up. # Pretty much need it for postmaster. [ ${NETWORKING} = "no" ] && exit 0 ZSERV=/usr/local/bin/zserv.exe [ -f $ZSERV ] || exit 0 # See how we were called. case "$1" in start) echo -n "Starting zserv service: " cd /data/bin/zserv/ /bin/mv nohup.out nohup.old /usr/bin/nohup $ZSERV -s 25000 & sleep 1 # /bin/chmod a+rw nohup.out echo -n "Starting zuop service: " cd /data/bin/zuop/ /bin/mv nohup.out nohup.old /usr/bin/nohup $ZSERV -connect -s 25003 & sleep 1 /bin/chmod a+rw nohup.out echo -n "Starting zapps service: " cd /data/bin/zapps/ /bin/mv nohup.out nohup.old # /bin/mv /usr/local/info/zapps.log /usr/local/info/zapps.log.! /usr/bin/nohup $ZSERV -connect -s 25001 & # $ZSERV -connect -s 25001 < /dev/null > /usr/local/info/zapps.log & sleep 1 # /bin/chmod a+rw nohup.out echo -n "Starting Task's service: " cd /data/task/ /bin/mv nohup.out nohup.old /usr/bin/nohup $ZSERV -s 25002 & sleep 1 # /bin/chmod a+rw nohup.out pid=`pidof $ZSERV` echo -n "zserv [$pid]" echo $pid > /var/run/zserv.pid echo echo echo "+---------------------------------------+" echo "| Remember! Reboot Server KOK.IT.RU !!! |" echo "+---------------------------------------+" echo ;; stop) echo -n "Stopping zserv service: " killproc zserv sleep 1 rm -f /var/run/zserv.pid echo ;; status) status zserv ;; restart) $0 stop $0 start ;; *) echo "Usage: zserv {start|stop|status|restart}" exit 1 esac exit 0
Конфигурационный файл /etc/init.d/zserv (grossb)
[root@grossb /root]# less /etc/rc.d/init.d/zserv #! /bin/sh # zserv This is the init script for starting up the ZSERV # server # # chkconfig: 345 85 15 # description: Starts and stops the ZSERV daemon that handles \ # all database requests. # processname: zserv # pidfile: /var/run/zserv.pid # # Source function library. . /etc/rc.d/init.d/functions # Get config. . /etc/sysconfig/network # Check that networking is up. # Pretty much need it for postmaster. [ ${NETWORKING} = "no" ] && exit 0 ZSERV=/usr/local/bin/zserv.exe [ -f $ZSERV ] || exit 0 # See how we were called. case "$1" in start) echo -n "Starting zserv service: " cd /data/bin/zserv/ /bin/mv nohup.old nohup.old.old /bin/mv nohup.out nohup.old sleep 1 /usr/bin/nohup $ZSERV -s 25000 & sleep 1 /bin/chmod a+rw nohup.out sleep 1 echo -n "Starting ztask service: " cd /data/bin/ztask/ /bin/mv nohup.out nohup.old /usr/bin/nohup $ZSERV -s 25001 -h /data/tasksrv/ & sleep 1 /bin/chmod a+rw nohup.out sleep 1 # echo -n "Starting zapps service: " # cd /data/bin/zapps/ # /bin/mv nohup.old nohup.old.old # /bin/mv nohup.out nohup.old # sleep 1 # nohup $ZSERV -connect -s 25003 & # sleep 1 # /bin/chmod a+rw nohup.out pid=`pidof zserv.exe` echo -n "zserv [$pid]" echo $pid > /var/run/zserv.pid echo ;; stop) echo -n "Stopping zserv service: " killproc zserv sleep 2 rm -f /var/run/zserv.pid echo ;; status) status zserv ;; restart) $0 stop $0 start ;; *) echo "Usage: zserv {start|stop|status|restart}" exit 1 esac exit 0
Конфигурационный файл /etc/init.d/zserv (mts)
[root@mts /root]# less /etc/rc.d/init.d/zserv #! /bin/sh # zserv This is the init script for starting up the ZSERV # server # # chkconfig: 345 85 15 # description: Starts and stops the ZSERV daemon that handles \ # all database requests. # processname: zserv # pidfile: /var/run/zserv.pid # # Source function library. . /etc/rc.d/init.d/functions # Get config. . /etc/sysconfig/network # Check that networking is up. # Pretty much need it for postmaster. [ ${NETWORKING} = "no" ] && exit 0 ZSERV=/usr/local/bin/zserv.exe BASE4MTS=/data/bases4mts/ MTSBASES=/data/subconto.tsk/ [ -f $ZSERV ] || exit 0 # See how we were called. case "$1" in start) # echo -n "Begin copying bases 4 mts" /bin/rm -f /data/subconto.tsk/bank.dbf/*.ntx /bin/cp -v -f /data/bases4mts/bank.dbf/bank.dbf /data/subconto.tsk/bank.dbf/bank.dbf /bin/cp -v -f /data/bases4mts/bank.dbf/swift.dbf /data/subconto.tsk/bank.dbf/swift.dbf /bin/rm -f /data/subconto.tsk/client.dbf/*.ntx /bin/cp -v -f /data/bases4mts/client.dbf/client.dbf /data/subconto.tsk/client.dbf/client.dbf /bin/cp -v -f /data/bases4mts/client.dbf/clnbuf.dbf /data/subconto.tsk/client.dbf/clnbuf.dbf /bin/cp -v -f /data/bases4mts/client.dbf/clncnt.dbf /data/subconto.tsk/client.dbf/clncnt.dbf /bin/rm -f /data/subconto.tsk/kadr.dbf/*.ntx /bin/cp -v -f /data/bases4mts/kadr.dbf/inn.dbf /data/subconto.tsk/kadr.dbf/inn.dbf /bin/cp -v -f /data/bases4mts/kadr.dbf/m8001h.dbf /data/subconto.tsk/kadr.dbf/m8001h.dbf /bin/cp -v -f /data/bases4mts/kadr.dbf/m8001s.dbf /data/subconto.tsk/kadr.dbf/m8001s.dbf /bin/cp -v -f /data/bases4mts/kadr.dbf/m8001z.dbf /data/subconto.tsk/kadr.dbf/m8001z.dbf /bin/rm -f /data/subconto.tsk/kladr.dbf/*.ntx /bin/cp -v -f /data/bases4mts/kladr.dbf/kladr.dbf /data/subconto.tsk/kladr.dbf/kladr.dbf /bin/cp -v -f /data/bases4mts/kladr.dbf/street.dbf /data/subconto.tsk/kladr.dbf/street.dbf /bin/rm -f /data/subconto.tsk/podr.dbf/*.ntx /bin/cp -v -f /data/bases4mts/podr.dbf/m8183.dbf /data/subconto.tsk/podr.dbf/m8183.dbf /bin/cp -v -f /data/bases4mts/podr.dbf/m8184.dbf /data/subconto.tsk/podr.dbf/m8184.dbf /bin/rm -f /data/bin/zrepl4mts/user/*.ntx /bin/cp -v -f /data/bin/zserv/user/admaddr.dbf /data/bin/zrepl4mts/user/admaddr.dbf /bin/cp -v -f /data/bin/zserv/user/base.dbf /data/bin/zrepl4mts/user/base.dbf /bin/cp -v -f /data/bin/zserv/user/equal.dbf /data/bin/zrepl4mts/user/equal.dbf /bin/cp -v -f /data/bin/zserv/user/keys.dbf /data/bin/zrepl4mts/user/keys.dbf /bin/cp -v -f /data/bin/zserv/user/lbase.dbf /data/bin/zrepl4mts/user/lbase.dbf /bin/cp -v -f /data/bin/zserv/user/lgroup.dbf /data/bin/zrepl4mts/user/lgroup.dbf /bin/cp -v -f /data/bin/zserv/user/lreport.dbf /data/bin/zrepl4mts/user/lreport.dbf /bin/cp -v -f /data/bin/zserv/user/luser.dbf /data/bin/zrepl4mts/user/luser.dbf /bin/cp -v -f /data/bin/zserv/user/proc.dbf /data/bin/zrepl4mts/user/proc.dbf /bin/cp -v -f /data/bin/zserv/user/report.dbf /data/bin/zrepl4mts/user/report.dbf /bin/cp -v -f /data/bin/zserv/user/slug.dbf /data/bin/zrepl4mts/user/slug.dbf /bin/cp -v -f /data/bin/zserv/user/sysdates.dbf /data/bin/zrepl4mts/user/sysdates.dbf /bin/cp -v -f /data/bin/zserv/user/user.dbf /data/bin/zrepl4mts/user/user.dbf echo -n "Starting zrepl 4 mts service: " cd /data/bin/zrepl4mts/ /bin/mv nohup.old nohup.old.old /bin/mv nohup.out nohup.old sleep 1 /usr/bin/nohup $ZSERV -s 25000 & sleep 1 /bin/chmod a+rw nohup.out sleep 1 echo -n "Starting zserv service: " echo -n "Starting zserv service: " cd /data/bin/zserv/ /bin/mv nohup.old nohup.old.old /bin/mv nohup.out nohup.old sleep 1 /usr/bin/nohup $ZSERV -connect -s 27000 & sleep 1 /bin/chmod a+rw nohup.out sleep 1 echo -n "Starting ztask service: " cd /data/bin/ztask/ /bin/mv nohup.out nohup.old /usr/bin/nohup $ZSERV -s 27001 -h /data/progs/tasksrv/ & sleep 1 /bin/chmod a+rw nohup.out sleep 1 echo -n "Starting zapps service: " cd /data/bin/zapps/ /bin/mv nohup.old nohup.old.old /bin/mv nohup.out nohup.old sleep 1 nohup $ZSERV -connect -s 27003 & sleep 1 /bin/chmod a+rw nohup.out pid=`pidof zserv.exe` echo -n "zserv [$pid]" echo $pid > /var/run/zserv.pid echo ;; stop) echo -n "Stopping zserv service: " killproc zserv sleep 2 rm -f /var/run/zserv.pid echo ;; status) status zserv ;; restart) $0 stop $0 start ;; *) echo "Usage: zserv {start|stop|status|restart}" exit 1 esac exit 0
Конфигурационный файл /etc/init.d/zserv (sos)
[root@sos /root]# less /etc/rc.d/init.d/zserv #! /bin/sh # zserv This is the init script for starting up the ZSERV # server # # chkconfig: 345 85 15 # description: Starts and stops the ZSERV daemon that handles \ # all database requests. # processname: zserv # pidfile: /var/run/zserv.pid # # Source function library. . /etc/rc.d/init.d/functions # Get config. . /etc/sysconfig/network # Check that networking is up. # Pretty much need it for postmaster. [ ${NETWORKING} = "no" ] && exit 0 ZSERV=/usr/local/bin/zserv.exe ZSERV1=/data/bin/zrep/zserv.exe ZSERVSOS=/usr/local/bin/zservsos.exe [ -f $ZSERV ] || exit 0 # See how we were called. case "$1" in start) echo -n "Starting zserv service: " cd /data/bin/zserv/ /bin/mv nohup.out nohup.old /usr/bin/nohup $ZSERV -s 25000 & # -usleep 2 & sleep 1 # /bin/chmod a+rw hohup.out echo -n "Starting zapps service: " cd /data/bin/zrep/ /bin/mv nohup.out nohup.old /usr/bin/nohup $ZSERV -connect -s 25001 & sleep 1 # /bin/chmod a+rw hohup.out # echo -n "Starting Task's service: " # cd /data/task/ # /bin/mv nohup.out nohup.old # /usr/bin/nohup $ZSERV -s 25002 & # sleep 1 # /bin/chmod a+rw hohup.out # echo -n "Starting zserv SOS 28000 service: " # cd /data/bin/zservsos/ # /bin/mv nohup.out nohup.old # /usr/bin/nohup $ZSERVSOS -s 28000 & # -usleep 2 & # sleep 1 # /bin/chmod a+rw hohup.out pid=`pidof zserv.exe` # pid=`pidof zserv` echo -n "zserv [$pid]" echo $pid > /var/run/zserv.pid echo ;; stop) echo -n "Stopping zserv service: " killproc zserv sleep 1 rm -f /var/run/zserv.pid echo ;; status) status zserv ;; restart) $0 stop $0 start ;; *) echo "Usage: zserv {start|stop|status|restart}" exit 1 esac exit 0
Конфигурационный файл /etc/init.d/zservsos (sos)
[root@sos /root]# less /etc/rc.d/init.d/zservsos #! /bin/sh # zservsos This is the init script for starting up the ZSERV # server # # chkconfig: 345 85 15 # description: Starts and stops the ZSERV daemon that handles \ # all database requests. # processname: zserv # pidfile: /var/run/zservsos.pid # # Source function library. . /etc/rc.d/init.d/functions # Get config. . /etc/sysconfig/network # Check that networking is up. # Pretty much need it for postmaster. [ ${NETWORKING} = "no" ] && exit 0 ZSERV=/usr/local/bin/zserv.exe ZSERVSOS=/usr/local/bin/zservsos.exe [ -f $ZSERVSOS ] || exit 0 # See how we were called. case "$1" in start) echo -n "Starting zserv SOS 28000 service: " cd /data/bin/zservsos/ /bin/mv nohup.old nohup.old.old /bin/mv nohup.out nohup.old sleep 1 /usr/bin/nohup $ZSERVSOS -connect -s 28000 & sleep 1 /bin/chmod a+rw nohup.out sleep 1 echo -n "Starting ztask SOS 28001 service: " cd /data/bin/ztasksos/ /bin/mv nohup.out nohup.old /usr/bin/nohup $ZSERVSOS -s 28001 -h /data/progs/tasksrv/ & sleep 1 /bin/chmod a+rw nohup.out sleep 1 echo -n "Starting zapps SOS 28000 service: " cd /data/bin/zappsos/ /bin/mv nohup.old nohup.old.old /bin/mv nohup.out nohup.old sleep 1 nohup $ZSERVSOS -connect -s 28003 & sleep 1 /bin/chmod a+rw nohup.out pid=`pidof zservsos.exe` echo -n "zservsos [$pid]" echo $pid > /var/run/zservsos.pid echo ;; stop) echo -n "Stopping zserv SOS 2800x service: " killproc zservsos sleep 2 rm -f /var/run/zservsos.pid echo ;; status) status zservsos ;; restart) $0 stop $0 start ;; *) echo "Usage: zservsos {start|stop|status|restart}" exit 1 esac exit 0