The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 118β€…    Votes:  0β€…    βœ… Solution
Tags: notification   process   notify-send   eyesome  
Link: πŸ” See Original Answer on Ask Ubuntu ⧉ πŸ”—

URL: https://askubuntu.com/q/1160849
Title: Check for running proccess constantly
ID: /2019/07/24/Check-for-running-proccess-constantly
Created: July 24, 2019
Upload: September 15, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


Using pgrep gives the least information. Using ps -aux | grep can provide too much at times:

$ pgrep eyesome
1200
1217
1226

$ ps -aux | grep eyesome
root      1197  0.0  0.0   4504   696 ?        Ss   07:36   0:00 /bin/sh -c    /usr/local/bin/eyesome.sh
root      1200  0.0  0.0  13380  3912 ?        S    07:36   0:01 /bin/bash /usr/local/bin/eyesome.sh
root      1217  0.0  0.0  12768  3308 ?        S    07:36   0:00 /bin/bash /usr/local/bin/eyesome-dbus.sh
root      1226  0.0  0.0  12768  2368 ?        S    07:36   0:00 /bin/bash /usr/local/bin/eyesome-dbus.sh
root     10567  0.0  0.0  54792  3964 pts/18   S    10:27   0:00 sudo eyesome/movie.sh asdf
root     10568  0.0  0.0  12896  3380 pts/18   S    10:27   0:08 /bin/bash eyesome/movie.sh asdf
rick     26612  0.0  0.0  14224  1020 pts/19   S+   16:52   0:00 grep --color=auto eyesome

So let’s narrow it down whilst making it user-friendly:

$ ps -aux | grep "sudo eyesome/movie" | grep -v grep
root     10567  0.0  0.0  54792  3964 pts/18   S    10:27   0:00 sudo eyesome/movie.sh asdf

Now put it into a script that you have loaded in Startup Applications:

#!/bin/bash
# Name: checkrunning.sh
# For: https://askubuntu.com/questions/1160844/check-for-running-proccess-constantly

while true; do

    Running=$(ps -aux | grep "sudo eyesome/movie" | grep -v grep)
    if [[ "$Running" == "" ]]
    then
        echo "NOT Running"
    else
        echo "Running: $Running"
    fi
    sleep 10

done

Mark the file as executable using:

chmod /path/to/checkrunning.sh

Replace the echo commands with notify-send.

⇧ Finally updated laptop from Windows 10 to Ubuntu 18.04; the keyboard and mouse no longer works after getting to the lock screen How (else) can I clear space on `/boot` so `do-release-upgrade` will work?  β‡©