User Tools

Site Tools


notes:screen

Screen Stuff

Very useful utility that can be used to run unattended software.

Monitoring Software

Script to start the monitoring software in screen. EXEC is the executable name and SMON should contain screen label.

my1mon.sh
#!/bin/bash
 
THATPATH=$(cd $(dirname $0);pwd)
THATNAME="my1mon"
THATEXEC="my1run"
 
[ ! -d "$THATPATH" ] && exit 1
[ ! -f "${THATPATH}/${THATEXEC}" ] && exit 2
 
cd "$THATPATH"
screen -wipe >/dev/null
check=`screen -ls | grep "$THATNAME"`
if [ "$check" = "" ] ; then
  echo -n "Creating new screen... "
  screen -d -m -S "$THATNAME"
  echo "done."
fi
check=`screen -ls | grep "$THATNAME"`
if [ "$check" = "" ] ; then
  echo "Screen not found! Aborting!"
  exit 1
else
  echo -n "Starting monitor in screen... "
  screen -S "$THATNAME" -X stuff "./${THATEXEC}^M"
  echo "done."
fi

To start it every time the system starts, add the following code to startup script (e.g. rc.local)

su -c 'sh /home/user/mymon/my1mon.sh' - user

Cron Job entry to register IP at 8pm every night

0 20 * * * /home/user/slackware/slackstuff/chkip user@serverhost:temp/
notes/screen.txt · Last modified: 2020/09/24 20:50 by 127.0.0.1