I have a script which runs when the system boot first time. But that same script second time also used by skiping one command only.
So i was trying with variable but it seems there is no way to track it.
E.g: /var/tmp/runme.sh << this same script is to use
#!/bin/bash
mkfifo pipe;
mkfifo pipe1;
ps aux | grep Java.jar | awk '{print $2}' | xargs kill -9;
sleep 1;
#
# Question on this:
# only one time it execute / its my application boot process
# - this is only one time on system startup
#
##############################################################
export DISPLAY=:0.0 && java -cp Java.jar main.Boot &
#
# second time this following should always execute
# This is my software kernel, which crash often
# on the fly i restart it
#
while true; do cat /var/jpeg1.jpeg >> pipe; done
while true; do cat /var/jpeg2.jpeg >> pipe1; done
export DISPLAY=:0.0 && java -cp Java.jar main.Desktop &
Just use a lockfile 🙂 Eg: at the begining of the script add:
Please remember to delete $tmpfile in script at system shutdown OR in script at early stage of boot!