How to combine 3 commands into a single process for runit to monitor?

70 Views Asked by At

I wrote a script that grabs a set of parameters from two sources using wget commands, stores them into a variables and then executes video transcoding process based on the retrieved parameters. Runit was installed to monitor the process.

The problem is that when I try to stop the process, runit doesnt know that only the last transcoding process needs to be stopped therefore it fails to stop it.

How can I combine all the commands in bash script to act as a single process/app?

The commands are something as follows:

wget address/id.html
res=$(cat res_id | grep id.html)
wget address/length.html
time=$(cat length_id | grep length.html)
/root/bin -i video1.mp4 -s $res.....................
1

There are 1 best solutions below

1
On

Try wrapping them in a shell:

sh -c '
    wget address/id.html
    res=$(grep id.html res_id)
    wget address/length.html
    time=$(grep length.html length_id)
    /root/bin -i video1.mp4 -s $res.....................
'