The officially official Devuan Forum!

You are not logged in.

#1 2021-12-20 05:08:04

torquebar
Member
Registered: 2021-09-15
Posts: 33  

execute a script on log-in

In Artix, Slackware and Suse I can as a user include a line
like:

makeafile.bsh

in the file ~.profile and make that script executable in
directory ~/bashers and then link to it in ~/bashers-linked

To get that path permanently into $PATH I do

export PATH=$PATH:$HOME/bashers-linked

or I can give the full path to the link in ~.profile

~/bashers-linked/makeafile.bsh

This achieves the desired result ...EXCEPT in Devuan.

The script executes if commanded, it's just that I can't
get it to auto-execute on login :-(

Is ~.profile read at all? 

What else should I investigate?

TIA


Who, has loved us more?

Offline

#2 2021-12-20 05:50:41

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,084  
Website

Re: execute a script on log-in


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII, 18.

Offline

#3 2021-12-20 20:44:02

torquebar
Member
Registered: 2021-09-15
Posts: 33  

Re: execute a script on log-in

Thanks, interesting reads. I was certain that no distro logged
a user in without executing ~/.profile   ...wrong again!

I even tried it in ~/.bashrc that didn't work either, fortunately
it's not a vital issue, in the interim until solution-day I can just
rig a button in the panel to do the same thing on a click.


Who, has loved us more?

Offline

#4 2021-12-20 21:00:13

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,084  
Website

Re: execute a script on log-in

Here's a solution (run as your normal user):

tee ~/.xessionrc <<!
export PATH="$PATH":"$HOME"/bashers-linked
[ -f ~/.profile ] && . ~/.profile
!

Then log out & back in again.

EDIT: that creates a file at ~/.xsessionrc with the content listed between the exclamation marks. Note to self: stop being such an insufferable smart-ass...

Last edited by Head_on_a_Stick (2021-12-20 21:03:21)


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII, 18.

Offline

#5 2022-02-04 01:23:58

torquebar
Member
Registered: 2021-09-15
Posts: 33  

Re: execute a script on log-in

Head_on_a_Stick wrote:

Here's a solution (run as your normal user):

tee ~/.xessionrc <<!
export PATH="$PATH":"$HOME"/bashers-linked
[ -f ~/.profile ] && . ~/.profile
!

Then log out & back in again.

EDIT: that creates a file at ~/.xsessionrc with the content listed between the exclamation marks. Note to self: stop being such an insufferable smart-ass...

thanks, I'll try that, been busy with other things :-)


Who, has loved us more?

Offline

#6 2022-02-04 02:12:30

torquebar
Member
Registered: 2021-09-15
Posts: 33  

Re: execute a script on log-in

Head_on_a_Stick wrote:

Here's a solution (run as your normal user):

tee ~/.xessionrc <<!
export PATH="$PATH":"$HOME"/bashers-linked
[ -f ~/.profile ] && . ~/.profile
!

Then log out & back in again.

EDIT: that creates a file at ~/.xsessionrc with the content listed between the exclamation marks. Note to self: stop being such an insufferable smart-ass...

...done

Now I can click the script I credit to 

0-BitTwisters-siggen.bsh

which creates the sig below

The call is still in .profile  as well

###########################################################
###########################################################
#https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=752129
export PATH=$PATH:$HOME/0/bashers-linked
bash ~/0/bashers-linked/0-BitTwisters-siggen.bsh
###########################################################
###########################################################

How do I get this done auto on log-in?  I'm thinking of a similar
inclusion in .xsession.rc to execute .profile 
{but maybe it's better if I don't think too much}

--
Devuan GNU/Linux 4 (chimaera), Kernel=5.10.0-11-amd64 on x86_64,
DM=Unknown, DE=XFCE, ST=x11,grub2, GPT, BIOS-boot


Who, has loved us more?

Offline

#7 2022-02-04 18:24:44

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,084  
Website

Re: execute a script on log-in

Remove the PATH line from ~/.xsessionrc if it's being set in ~/.profile and also remove the bash line from ~/.profile then you can call the script from .xsessionrc, like this:

0-BitTwisters-siggen.bsh

^ That's all you need if the script is executable, is in a PATH directory and has a #!/bin/bash shebang. No need to call the full path or prepend bash.

Alternatively remove any PATH additions and just call the full path to the script.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII, 18.

Offline

Board footer