-
-
Save hakopako/db7704ec48859475e395 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yum install -y glib2.i386 qt4.i386 zlib.i386 alsa-lib.i386 libX11.i386 libXv.i386 libXScrnSaver.i386 | |
# yum install -y xorg-x11-xauth xorg-x11-server-Xvfb x11vnc Xorg | |
# yum install -y python-setuptools | |
# easy_install Skype4Py | |
# easy_install ctypes | |
# cd /opt | |
# wget http://download.skype.com/linux/skype_static-2.1.0.47.tar.bz2 | |
# tar jxvf skype_static-2.1.0.47.tar.bz2 | |
# ln -s skype_static-2.1.0.47 skype | |
# ln -s /opt/skype /usr/share/skype | |
# ln -s /opt/skype/skype /usr/bin/skype | |
# wget https://gist.githubusercontent.com/hakopako/db7704ec48859475e395/raw/9d0c26bef7cc134e83ab3a39d9729b20a964592d/launch-skype.sh --no-check-certificate | |
# vim launch-skype.sh | |
USERNAME=<BOTアカウント> | |
PASSWORD=<BOTアカウントのパスワード> | |
# mv launch-skype.sh /etc/init.d/skype | |
# mkdir /var/run/skype /var/log/skype /var/db/skype | |
# /etc/init.d/xfs start | |
# /etc/init.d/skype start | |
# x11vnc -storepasswd | |
# /usr/bin/x11vnc -rfbauth /root/.vnc/passwd -display :20 -xauth /var/run/skype/Xauthority |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Init file for daemonized Skype service | |
# | |
### BEGIN INIT INFO | |
# Provides: skype | |
# Required-Start: $local_fs $remote_fs $network | |
# Required-Stop: $local_fs $remote_fs $network | |
# Default-Start: 3 4 5 | |
# Default-Stop: 0 1 2 6 | |
# X-Interactive: false | |
# Short-Description: Start/stop daemonized Skype service | |
### END INIT INFO | |
# | |
# chkconfig: 345 80 10 | |
# | |
# processname: skype | |
# | |
# pidfile: /var/run/skype/skype.pid | |
# | |
if [ -r /etc/rc.d/init.d/functions ]; then | |
. /etc/rc.d/init.d/functions | |
log_daemon_msg() { | |
msg=$1 | |
prog=$2 | |
echo -n $"$msg $prog: " | |
} | |
log_end_msg() { | |
if [ "$1" = "0" ]; then | |
success | |
elif [ "$1" = "1" ]; then | |
failure | |
fi | |
echo | |
} | |
elif [ -r /lib/lsb/init-functions ]; then | |
. /lib/lsb/init-functions | |
else | |
echo "Could not find a helper script needed to run this script." | |
exit 1 | |
fi | |
DAEMON_USER=skype | |
PROGNAME=`basename $0` | |
PIDFILE=/var/run/skype/skype.pid | |
XSERVERNUM=20 | |
XAUTHFILE=/var/run/skype/Xauthority | |
LOGFILE=/var/log/skype/error.log | |
DBPATH=/var/db/skype | |
XAUTHPROTO=. | |
SKYPE=/opt/skype/skype | |
USERNAME=bar | |
PASSWORD=foo | |
[ -f /etc/sysconfig/skype ] && . /etc/sysconfig/skype | |
prog="skype" | |
RETVAL=0 | |
dircheck() { | |
if [ ! -d `dirname "$1"` ]; then | |
echo "`dirname \"$1\"` does not exist" | |
return 1 | |
else | |
return 0 | |
fi | |
} | |
start() { | |
log_daemon_msg "Starting" "skype" | |
if ! dircheck "$LOGFILE" || ! dircheck "$XAUTHFILE"; then | |
log_end_msg 1 | |
echo | |
RETVAL=1 | |
return | |
fi | |
MCOOKIE=`mcookie` && \ | |
sudo -u "$DAEMON_USER" env XAUTHORITY=$XAUTHFILE sh -c "xauth add \":$XSERVERNUM\" \"$XAUTHPROTO\" \"$MCOOKIE\" >> \"$LOGFILE\" 2>&1" && \ | |
sudo -u "$DAEMON_USER" env XAUTHORITY=$XAUTHFILE sh -c "Xvfb :$XSERVERNUM -screen 0 800x600x8 -nolisten tcp >> \"$LOGFILE\" 2>&1 & echo \$!" >"$PIDFILE" && | |
sleep 3 && \ | |
(sudo -u "$DAEMON_USER" env DISPLAY=:$XSERVERNUM XAUTHORITY=$XAUTHFILE SKYPE="$SKYPE" sh -c "echo \"$USERNAME $PASSWORD\" | nohup \"$SKYPE\" --dbpath=\"$DBPATH\" --pipelogin &") >> "$LOGFILE" 2>&1 && \ | |
(log_end_msg 0 && [ -d /var/lock/subsys ] && touch /var/lock/subsys/skype || true) \ | |
|| (RETVAL=$?; kill -TERM `cat $PIDFILE`; log_end_msg 1) | |
} | |
stop() { | |
log_daemon_msg "Stopping" "skype" | |
if [ -e "$PIDFILE" ]; then | |
kill -TERM `cat $PIDFILE` && \ | |
rm -f $PIDFILE && \ | |
if [ -d /var/lock/subsys ]; then rm -f /var/lock/subsys/skype; fi && \ | |
log_end_msg 0 || log_end_msg 1 | |
else | |
log_end_msg 1 | |
RETVAL=1 | |
fi | |
} | |
usage() { | |
echo "Usage: $PROGNAME {start|stop|restart}" | |
} | |
case $1 in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
usage | |
RETVAL=255 | |
;; | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment