slash
slash copied to clipboard
Releasing an application to background
Hey there, I was trying to test this out and I am having a bit of an issue, I think I might be missing something?
I was trying to simply see if an application is running, if not, start it's daemon, then run a specific configuration.
#!/usr/local/bin/slash
pgrep -l "eww" $> eww_proc
if (stdout(eww_proc) == ""){
eww daemon # tried ending with &!, &, using nohup, etc.
eww open top-monitor # Same as above
}
I also tried the following:
#!/usr/local/bin/slash
pgrep -l "eww" $> eww_proc
if (stdout(eww_proc) == ""){
eww daemon && eww open top-monitor
}
None seem to work properly, though, so I just started trying whatever I could think of, lol. Ex:
#!/usr/local/bin/slash
pgrep -l "eww" $> eww_proc
if (stdout(eww_proc) == ""){
eww daemon 2> /dev/null &
eww open top-monitor 2> /dev/null &
}
What might I be missing when trying to run these two commands?
Thanks, -MH
I wanted to give it another go, so I tried this one as well:
#!/usr/local/bin/slash
ps aux | grep ' [A]ssetImportWorker0 ' | awk '{print $2}' $> unity_proc
if (stdout(unity_proc) != ""){
print(unity_proc)
}
but received:
[Running] /usr/local/bin/slash "/home/mosthated/_dev/languages/slash/check_unity.sl"
--> 3:55
|
3 | ps aux | grep ' [A]ssetImportWorker0 ' | awk '{print $2}' $> unity_proc
| ^---
|
= expected var_name
[Done] exited with code=1 in 0.015 seconds
The $2 in the awk argument should be escaped, as slash is trying to substitute.
awk '{print \$2}'
That said, I dont think I ever implemented the running in background part.