voip-sipgw02 ~ # ps --pid `pidof rsyslogd` -o etime,pid,user,args ELAPSED PID USER COMMAND 261-20:58:45 1228 root /usr/sbin/rsyslogd -n
The etime option means elapsed time since the process was started, in the form [[DD-]hh:]mm:ss.
voip-sipgw02 ~ # ps --pid `pidof rsyslogd` -o etime,pid,user,args ELAPSED PID USER COMMAND 261-20:58:45 1228 root /usr/sbin/rsyslogd -n
The etime option means elapsed time since the process was started, in the form [[DD-]hh:]mm:ss.
bastion@host:~$ cat pids.txt
1111
2222
3333
4444
bastion@host:~$ echo $(cat pids.txt)
1111 2222 3333 4444
for i in `
; do kill -9 $i ; doneecho $(cat killpids.txt)`
UPD: a note with alternative commands from Liviu Chircu, OpenSIPS core developer:
1. instead of `echo $(cat pids.txt)`, a better alternative would be: `cat pids.txt | xargs` 2. instead of "for i in `echo $(cat pids.txt)`; do kill -9 $i; done", a better option would be: `cat pids.txt | xargs kill -9`
#!/bin/bash #***************************************# #*****http://alexeyka.zantsev.com/******# #***************************************# BACKUP_DIR=/home/user/PBX_BACKUPS TAR="/bin/tar -czf" DATE=$(date +%Y-%m-%d) CDRDAY=$(date +%d) SQLDUMP="/usr/bin/mysqldump" SRVNAME=pbx_ #------------------------------------------------ # function for backup routine bkuper () { # 1. cd to dir cd $BACKUP_DIR mkdir BACKUP # 2. copy mission-critical shit for i in /etc/asterisk/ /etc/lighttpd/lighttpd.conf /etc/odbc.ini /etc/odbcinst.ini /var/scripts/ ; do /bin/cp -r $i BACKUP/ done # 3. CDR SQL dump on 28 day monthly if [ $CDRDAY == 28 ] then $SQLDUMP -u root -pRoOtPaSsWoRd db_asterisk_cdr > BACKUP/db_asterisk_cdr.$DATE.sql fi # 4. archivate $TAR $SRVNAME$DATE.tar.gz BACKUP/ # 5. delete shit /bin/rm -rf BACKUP/ } #------------------------------------------------ # fire! if [ -d $BACKUP_DIR ] then bkuper else /bin/mkdir $BACKUP_DIR bkuper fi # remove older than 30 days old backups find $BACKUP_DIR -type f -name "*z" -mtime +30 -execdir rm -f {} \; exit $?
A nice article about target directory, moving and copying files/directories.
http://www.gnu.org/software/coreutils/manual/html_node/Target-directory.html#Target-directory
The command is grep -vE '^#|^;|^$' /etc/openvpn/client.conf
This is the output:
client
dev tun
proto udp
remote 10.11.12.13 1194
topology subnet
nobind
persist-key
persist-tun
ca /etc/openvpn/ca.crt
cert /etc/openvpn/client3.crt
key /etc/openvpn/client3.key
comp-lzo
verb 3
Предполагается, что по SSH зашли под тем же пользователем, который зашёл на компьютер в GUI и локально. То есть зашли по SSH под логином john, и локально в GUI вход выполнен под пользователем john.
Допустим, нужно удаленно запустить Pidgin.
Выполняем по SSH команды:
export DISPLAY=:0
pidgin &
В итоге на удалённом компьютере запустится Pidgin.