aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilly Sudiarto Raharjo <willysr@slackbuilds.org>2020-02-15 09:57:50 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2020-02-15 09:57:50 +0700
commit7d7723f7e6d6696e806aae100deb0f3b82fb4b4e (patch)
tree4349147baa20eaa7412f93053a7505721ece00ae
parentf6dfa5f402a39ed80706b797ee4b833f40f17e62 (diff)
system/xrdp: Add missing files.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--system/xrdp/rc.xrdp153
-rw-r--r--system/xrdp/xrdp11
-rw-r--r--system/xrdp/xrdp-sesman11
3 files changed, 175 insertions, 0 deletions
diff --git a/system/xrdp/rc.xrdp b/system/xrdp/rc.xrdp
new file mode 100644
index 000000000000..d68ac6ac950f
--- /dev/null
+++ b/system/xrdp/rc.xrdp
@@ -0,0 +1,153 @@
+#!/bin/sh
+# xrdp control script
+# Written : 1-13-2006 - Mark Balliet - posicat@pobox.com
+# maintaned by Jay Sorg
+# chkconfig: 2345 11 89
+# description: starts xrdp
+
+### BEGIN INIT INFO
+# Provides: xrdp
+# Required-Start:
+# Required-Stop:
+# Should-Start:
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start and stop xrdp
+# Description: starts xrdp
+### END INIT INFO
+
+SBINDIR=/usr/sbin
+LOG=/dev/null
+CFGDIR=/etc/xrdp
+
+if ! test -x $SBINDIR/xrdp
+then
+ echo "xrdp is not executable"
+ exit 0
+fi
+if ! test -x $SBINDIR/xrdp-sesman
+then
+ echo "xrdp-sesman is not executable"
+ exit 0
+fi
+if ! test -x $CFGDIR/xrdp-xinitrc
+then
+ echo "xrdp-xinitrc is not executable"
+ exit 0
+fi
+
+xrdp_start()
+{
+ echo -n "Starting: xrdp and sesman . . "
+ $SBINDIR/xrdp >> $LOG
+ $SBINDIR/xrdp-sesman >> $LOG
+ echo "."
+ sleep 1
+ return 0;
+}
+
+xrdp_stop()
+{
+ echo -n "Stopping: xrdp and sesman . . "
+ $SBINDIR/xrdp-sesman --kill >> $LOG
+ $SBINDIR/xrdp --kill >> $LOG
+ echo "."
+ return 0;
+}
+
+is_xrdp_running()
+{
+ ps u --noheading -C xrdp | grep -q -i xrdp
+ if test $? -eq 0
+ then
+ return 1;
+ else
+ return 0;
+ fi
+}
+
+is_sesman_running()
+{
+ ps u --noheading -C xrdp-sesman | grep -q -i xrdp-sesman
+ if test $? -eq 0
+ then
+ return 1;
+ else
+ return 0;
+ fi
+}
+
+check_up()
+{
+ # Cleanup : If sesman isn't running, but the pid exists, erase it.
+ is_sesman_running
+ if test $? -eq 0
+ then
+ if test -e /var/run/xrdp-sesman.pid
+ then
+ rm /var/run/xrdp-sesman.pid
+ fi
+ fi
+ # Cleanup : If xrdp isn't running, but the pid exists, erase it.
+ is_xrdp_running
+ if test $? -eq 0
+ then
+ if test -e /var/run/xrdp.pid
+ then
+ rm /var/run/xrdp.pid
+ fi
+ fi
+ return 0;
+}
+
+case "$1" in
+ start)
+ check_up
+ is_xrdp_running
+ if ! test $? -eq 0
+ then
+ echo "xrdp is already loaded"
+ exit 1
+ fi
+ is_sesman_running
+ if ! test $? -eq 0
+ then
+ echo "sesman is already loaded"
+ exit 1
+ fi
+ xrdp_start
+ ;;
+ stop)
+ check_up
+ is_xrdp_running
+ if test $? -eq 0
+ then
+ echo "xrdp is not loaded."
+ fi
+ is_sesman_running
+ if test $? -eq 0
+ then
+ echo "sesman is not loaded."
+ fi
+ xrdp_stop
+ ;;
+ force-reload|restart)
+ check_up
+ echo "Restarting xrdp ..."
+ xrdp_stop
+ is_xrdp_running
+ while ! test $? -eq 0
+ do
+ check_up
+ sleep 1
+ is_xrdp_running
+ done
+ xrdp_start
+ ;;
+ *)
+ echo "Usage: xrdp.sh {start|stop|restart|force-reload}"
+ exit 1
+esac
+
+exit 0
diff --git a/system/xrdp/xrdp b/system/xrdp/xrdp
new file mode 100644
index 000000000000..32b6aca2cd2f
--- /dev/null
+++ b/system/xrdp/xrdp
@@ -0,0 +1,11 @@
+/var/log/xrdp.log {
+ # create 644 root root
+ daily
+ # compress
+ # rotate 7
+ missingok
+ # postrotate
+ # /bin/kill -HUP `cat /var/run/xrdp.pid 2>/dev/null` 2> /dev/null || true
+ # endscript
+}
+
diff --git a/system/xrdp/xrdp-sesman b/system/xrdp/xrdp-sesman
new file mode 100644
index 000000000000..8b2984f8f566
--- /dev/null
+++ b/system/xrdp/xrdp-sesman
@@ -0,0 +1,11 @@
+/var/log/xrdp-sesman.log {
+ # create 644 root root
+ daily
+ # compress
+ # rotate 7
+ missingok
+ postrotate
+ /bin/kill -HUP `cat /var/run/xrdp-sesman.pid 2>/dev/null` 2> /dev/null || true
+ endscript
+}
+