You are not logged in.

#21 2025-07-03 17:07:19

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,026

Re: Start a script on resume. [SOLVED]

Conky Manager 2  Never did like Conky Manager.

At the bottom of this link check out the original poster ↓↓↓↓

Nice to know Ubuntu is still giving me credit for my 2008 post on how to setup conky.

I can't see it anymore as I am no longer signed in to Ubuntu forums.

I'm still using conky v1.9.0 so:

System config file: /etc/conky/conky.conf
Package library path: /usr/lib/conky

apply to me.

No idea where Brandon has put them in the latest conky.

But starting a conky (v1.9) in any place other than the two defaults;
1st: /etc/conky/conky.conf or
2nd: ~/.conkyrc  (only if created & becomes the default)
has always required the full path.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#22 2025-07-04 14:13:18

sleekmason
zoom
Registered: 2018-05-22
Posts: 1,108
Website

Re: Start a script on resume. [SOLVED]

Works well. Nice. Added bl-run-user to /usr/local/bin for ease of future use.

Offline

#23 2025-07-04 14:33:00

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,026

Re: Start a script on resume. [SOLVED]

sleekmason wrote:

Works well. Nice. Added bl-run-user to /usr/local/bin for ease of future use.

How did you hard code it to start with $USER?
EDIT: NM I see where john said copy/past .

Last edited by Sector11 (2025-07-04 15:35:41)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#24 2025-07-04 15:58:03

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,026

Re: Start a script on resume. [SOLVED]

Still not working.  sad
All three are executable.
1

/usr/local/bin/bl-run-user

→ John's script verbatim

2

/lib/systemd/system-sleep/bl-user-resume
#!/bin/sh

case $1 in
  post)
    /usr/local/bin/bl-run-user sector11 /home/sector11/bin/resume-3-conkys
    ;;
esac

3

/home/sector11/bin/resume-3-conkys
#!/bin/bash

##  see
##  /usr/local/bin/bl-run-user
##  and 
## /lib/systemd/system-sleep/bl-user-resume

conky -q -c /media/5/Conky/S11_Keybinds.conky &
conky -q -c /media/5/Conky/S11_Rem_Cal.conky &
conky -q -c /media/5/Conky/S11_Dates.conky &

exit

Still they do not run.  All three are executable.

Directories in my path:

   $ $PATH
bash: /home/sector11/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/sbin:/usr/sbin: No such file or directory

EDIT: Fixed the Tpyo Knig's input See sleekmasons post below.

Last edited by Sector11 (2025-07-04 15:59:17)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#25 2025-07-04 16:47:51

sleekmason
zoom
Registered: 2018-05-22
Posts: 1,108
Website

Re: Start a script on resume. [SOLVED]

Howdy @Sector11
You have a typo in this line:

/user/local/bin/bl-run-user sector11 /home/sector11/bin/resume-3-conkys

Should be

/usr/local/bin/bl-run-user sector11 /home/sector11/bin/resume-3-conkys

or if directly in your path, you can get away with just:

bl-run-user sector11 /home/sector11/bin/resume-3-conkys

Offline

#26 2025-07-04 18:05:49

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,026

Re: Start a script on resume. [SOLVED]

@ Sleekmason Well they do call me the Tpyo Knig for a reason.  smile

Thanks, will correct.

EDIT:  And that's a wrap!

Last edited by Sector11 (2025-07-04 18:28:46)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#27 2025-07-04 18:13:47

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,026

Re: Start a script on resume. [SOLVED]

To all, PackRat, johnraff, unklar, marens and sleekmason, thank you for your input.

Special thanks to johnraff for the slick fix and sleekmason for finding the Tpyo Knigs input.

SOLVED!


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#28 2025-07-04 18:20:34

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,695

Re: Start a script on resume. [SOLVED]

Hi @sleekmason, good to see you and I hope you are well.  smile
Hi @Sector11, my friend  wink

The solution presented by @johnraff works well here.

I had taken a different approach yesterday and today, using a script by @TomL from the debian-forum:
the script:

nano /usr/local/bin/journal-entry
    #!/bin/bash
    echo "User=unklar, Parm1=$1 Parm2=$2 Parm3=$3" | systemd-cat -t "unklar:`basename $0`" -p info
    exit 0

Then I created a service-unit with this content:

nano /usr/local/lib/systemd/system/after-suspend.service
    [Unit]
    Description=unklar:after-suspend.service: Start at suspend
    DefaultDependencies=no
    After=suspend.target

    [Service]
    Type=oneshot
    Environment=DISPLAY=:0
    ExecStart=/usr/local/bin/journal-entry "started from after-suspend.service "active/running" unklar "/home/unklar/.conky/rcmus_conkyrc10 &

    [Install]
    RequiredBy=suspend.target

then created a symlink

systemctl enable after-suspend.service
Created symlink '/etc/systemd/system/suspend.target.requires/after-suspend.service' → '/usr/local/lib/systemd/system/after-suspend.service'.

(all as root)

restart

Unfortunately, my solution does not (yet) work because I cannot find the error.  big_smile

ls -l journal-entry
-rwxr-xr-x 1 root root 130  4. Jul 13:24 journal-entry

ls -l after-suspend.service
-rwxrwxr-x 1 root root 378  4. Jul 16:52
# systemctl status after-suspend.service
× after-suspend.service - unklar:after-suspend.service: Start at suspend
     Loaded: loaded (/usr/local/lib/systemd/system/after-suspend.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Fri 2025-07-04 18:56:44 CEST; 3min 34s ago
 Invocation: 9e380b882e8046879bd090dc82bb5137
    Process: 17376 ExecStart=/usr/local/bin/journal-entry started from after-suspend.service active/running unklar /home/unklar/.conky/rcmus_conkyrc10 & (code=exited, status=203/EXEC)
   Main PID: 17376 (code=exited, status=203/EXEC)
   Mem peak: 1.8M
        CPU: 9ms

Jul 04 18:56:44 T500 systemd[1]: Starting after-suspend.service - unklar:after-suspend.service: Start at suspend...
-->Jul 04 18:56:44 T500 (al-entry)[17376]: after-suspend.service: Failed to execute /usr/local/bin/journal-entry: Exec format error
-->Jul 04 18:56:44 T500 (al-entry)[17376]: after-suspend.service: Failed at step EXEC spawning /usr/local/bin/journal-entry: Exec format error
Jul 04 18:56:44 T500 systemd[1]: after-suspend.service: Main process exited, code=exited, status=203/EXEC
Jul 04 18:56:44 T500 systemd[1]: after-suspend.service: Failed with result 'exit-code'.
Jul 04 18:56:44 T500 systemd[1]: Failed to start after-suspend.service - unklar:after-suspend.service: Start at suspend.

Offline

#29 2025-07-04 18:23:38

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,026

Re: Start a script on resume. [SOLVED]

Did a suspend - resume and shortened my "S11 Dates" and "Retires | Reminders" conkys because of personal info, but there it is with FF still running in the background.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#30 2025-07-04 18:27:52

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,026

Re: Start a script on resume. [SOLVED]

unklar wrote:

Hi @Sector11, my friend  wink
{snip}
The solution presented by @johnraff works well here.

Hi unklar ...

You're better at coding than I am I'm sure you'll figure it out if for no other reason: just to do it.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#31 2025-07-05 00:20:40

marens
Member
From: World without M$
Registered: 2023-02-02
Posts: 872

Re: Start a script on resume. [SOLVED]

johnraff wrote:

... and of course change "john" to your username, and the paths to bl-run-user and your conky script to whatever you used:

#!/bin/sh

case $1 in
  post)
    /home/john/scripts/bl-run-user john /home/john/scripts/conky-test-script
    ;;
esac

Is it possible to use $whoami  instead of different usernames ( "john" ) ?

$ whoami
marens

Something like this:

#!/bin/sh

case $1 in
  post)
    user_name=$(whoami)
    /home/$user_name/scripts/bl-run-user $user_name /home/$user_name/scripts/conky-test-script
    ;;
esac

Last edited by marens (2025-07-05 00:24:20)


If people would know how little brain is ruling the world, they would die of fear.

Offline

#32 2025-07-06 12:29:41

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,695

Re: Start a script on resume. [SOLVED]

Since @S11 has marked his thread as resolved, I'd like to continue this here: https://forums.bunsenlabs.org/viewtopic … 14#p144314
It still remains a ‘shooting at sparrows with cannons’ problem tongue but, as @johnraff already wrote, it has also aroused my interest wink

Last edited by unklar (2025-07-06 13:05:30)

Offline

#33 2025-07-07 06:44:29

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,652
Website

Re: Start a script on resume. [SOLVED]

marens wrote:
johnraff wrote:

... and of course change "john" to your username, and the paths to bl-run-user and your conky script to whatever you used...

Is it possible to use $whoami  instead of different usernames ( "john" ) ?

$ whoami
marens

No, because the tricky point about all this is that the action is being triggered by a script being run by root, but the final action has to be run by a user. 'whoami' would return 'root', and root would have no idea about which user was wanted to run the conky. It has to be hard-coded into the script.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#34 2025-07-07 06:59:18

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,652
Website

Re: Start a script on resume. [SOLVED]

sleekmason wrote:

Works well. Nice. Added bl-run-user to /usr/local/bin for ease of future use.

Hi @sleekmason, great to see you back! I heard you weren't well - are you at least well on the way to recovery now?

The precursor of  bl-run-user was bl-run-broadcast which ended up being part of the apt update checker which you contributed a lot of work to, in particular the bl-apt-update-check script.

b-r-broadcast runs the same command for all currently logged-in users, while b-r-user for only the specific user specified in the command line.

In fact since the two scripts are very similar, I might roll them together by adding a -u <username> option to bl-run-broadcast to make it behave like bl-run-user.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

Board footer

Powered by FluxBB