Sunday, February 6, 2022

Killing a process every day at certain time?

Gotta Schedule it with crontab -e (I use joe a wordstar equivalent)

alias cron='crontab -e'

=====================================================

root@ms2:/home/timc/bin# select-editor

Select an editor.  To change later, run 'select-editor'.
  1. /usr/bin/joe
  2. /usr/bin/jstar
  3. /usr/bin/jpico
  4. /usr/bin/jmacs
  5. /bin/nano        <---- easiest
  6. /usr/bin/vim.basic
  7. /usr/bin/rjoe
  8. /usr/bin/vim.tiny
  9. /bin/ed

=====================================================

4 0 * * * /home/timc/bin/kill.exp.sh &> /var/log/kill.log

===========================================================

#!/bin/bash
#ps -elf | grep chia | grep exp > t

TOUCH=/usr/bin/touch
ECHO=/usr/bin/echo
CHMOD=/usr/bin/chmod
RM=/usr/bin/rm
PS=/usr/bin/ps
CAT=/usr/bin/cat
GREP=/usr/bin/grep
AWK=/usr/bin/awk

DIR="/home/timc/bin"
TMPFILE="temp.kill.file"
KILLFILE="kill.up.exp.sh"

$RM $DIR/$TMPFILE
$RM $DIR/$KILLFILE
$TOUCH $DIR/$TMPFILE
$TOUCH $DIR/$KILLFILE

$PS -elf | $GREP chia | $GREP exp | $AWK '{print $4}' >> $TMPFILE

$ECHO "Start kill file to exec  (kill.up.exp.sh)"
$CAT $DIR/$TMPFILE | while read line
do
  $ECHO kill -9 $line >> $DIR/$KILLFILE
done
$CHMOD 755 $DIR/$KILLFILE
$DIR/$KILLFILE
  1. Michaeldor

    Monday, August 21, 2023 - 15:25:01

    https://www.adulthubtube.com/

  2. GeorgePar

    Tuesday, August 22, 2023 - 04:04:20

    https://www.daylyporn.com/

  3. Careyulcef

    Wednesday, September 27, 2023 - 19:06:23

    It was my error.

    ——
    https://avenue17.ru/

Add comment

Fill out the form below to add your own comments