Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing an application to background #1

Open
MostHated opened this issue Apr 29, 2022 · 3 comments
Open

Releasing an application to background #1

MostHated opened this issue Apr 29, 2022 · 3 comments

Comments

@MostHated
Copy link

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

@MostHated
Copy link
Author

MostHated commented Apr 30, 2022

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

@mikkeldamsgaard
Copy link
Owner

The $2 in the awk argument should be escaped, as slash is trying to substitute.
awk '{print \$2}'

@mikkeldamsgaard
Copy link
Owner

That said, I dont think I ever implemented the running in background part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants