Re: mounting backup filesystem on-demand (was Re: Checking for a mount in a shell script)

2025-05-21 Thread Jonathan Dowland
On Wed May 21, 2025 at 10:09 AM BST, Dan Purgert wrote: As far as I know namespaces (read: poorly), the backup script would need to execute setns(2) in order to join the previously created namespace for your "/backup" target. But, I've only used them with networking devices,

Re: mounting backup filesystem on-demand (was Re: Checking for a mount in a shell script)

2025-05-21 Thread Jonathan Dowland
On Wed May 21, 2025 at 10:05 AM BST, Nicolas George wrote: Does it mean you like your backup drive to be permanently plugged to the computer? That protects you from hardware failures and human mistakes, but not from large physical damage or theft. This drive is permanently connected to this co

Re: mounting backup filesystem on-demand (was Re: Checking for a mount in a shell script)

2025-05-21 Thread tomas
On Wed, May 21, 2025 at 11:38:38AM +0200, Nicolas George wrote: > to...@tuxteam.de (HE12025-05-21): > > Actually, this makes a lot of sense (well, nearly): keep backup constantly > > synced, unmount/mount only on media rotation, carry freshly unmounted > > medium to safe place. > > It only becomes

Re: mounting backup filesystem on-demand (was Re: Checking for a mount in a shell script)

2025-05-21 Thread Nicolas George
to...@tuxteam.de (HE12025-05-21): > Actually, this makes a lot of sense (well, nearly): keep backup constantly > synced, unmount/mount only on media rotation, carry freshly unmounted > medium to safe place. It only becomes an effective backup at the time it is unmounted to move the medium to the s

Re: mounting backup filesystem on-demand (was Re: Checking for a mount in a shell script)

2025-05-21 Thread tomas
On Wed, May 21, 2025 at 11:05:37AM +0200, Nicolas George wrote: > Jonathan Dowland (HE12025-05-21): > > I'd like /backup permanently > > mounted > > Does it mean you like your backup drive to be permanently plugged to the > computer? That protects you from h

Re: mounting backup filesystem on-demand (was Re: Checking for a mount in a shell script)

2025-05-21 Thread Nicolas George
Jonathan Dowland (HE12025-05-21): > I'd like /backup permanently > mounted Does it mean you like your backup drive to be permanently plugged to the computer? That protects you from hardware failures and human mistakes, but not from large physical damage or

Re: mounting backup filesystem on-demand (was Re: Checking for a mount in a shell script)

2025-05-21 Thread Dan Purgert
On May 21, 2025, Jonathan Dowland wrote: > On Tue May 20, 2025 at 3:50 PM BST, Dan Purgert wrote: > > I used /mnt/backup because I only wanted the partition mounted while the > > backup was running (it was one of several on that physical drive). The > > backup script did the m

mounting backup filesystem on-demand (was Re: Checking for a mount in a shell script)

2025-05-21 Thread Jonathan Dowland
On Tue May 20, 2025 at 3:50 PM BST, Dan Purgert wrote: I used /mnt/backup because I only wanted the partition mounted while the backup was running (it was one of several on that physical drive). The backup script did the mount/rsync/unmount as part of the execution. Really, the only point of

Re: Checking for a mount in a shell script

2025-05-20 Thread tomas
On Tue, May 20, 2025 at 11:35:14AM -0400, Lee wrote: > On Tue, May 20, 2025 at 10:08 AM tomas wrote: > > > > On Tue, May 20, 2025 at 09:45:11AM -0400, Lee wrote: > > > On Tue, May 20, 2025 at 9:33 AM wrote: > > > > [...] > > > > > > What do you do if you get two USBs containing file systems with >

Re: Checking for a mount in a shell script

2025-05-20 Thread Lee
On Tue, May 20, 2025 at 10:08 AM tomas wrote: > > On Tue, May 20, 2025 at 09:45:11AM -0400, Lee wrote: > > On Tue, May 20, 2025 at 9:33 AM wrote: > > [...] > > > > What do you do if you get two USBs containing file systems with > > > the same UUID? > > > > Is that possible? I suppose it is.. so I'

Re: Checking for a mount in a shell script

2025-05-20 Thread tomas
On Tue, May 20, 2025 at 10:50:50AM -0400, Dan Purgert wrote: [...] > I used /mnt/backup because I only wanted the partition mounted while the > backup was running (it was one of several on that physical drive). The > backup script did the mount/rsync/unmount as part of the execution.

Re: Checking for a mount in a shell script

2025-05-20 Thread Dan Purgert
e instead of automatically > mounting to > /media/$USER/filesystem-UUID ? I used /mnt/backup because I only wanted the partition mounted while the backup was running (it was one of several on that physical drive). The backup script did the mount/rsync/unmount as part of the execution. Really, th

Re: Checking for a mount in a shell script

2025-05-20 Thread tomas
On Tue, May 20, 2025 at 09:45:11AM -0400, Lee wrote: > On Tue, May 20, 2025 at 9:33 AM wrote: [...] > > What do you do if you get two USBs containing file systems with > > the same UUID? > > Is that possible? I suppose it is.. so I'd go looking for how to > change the UUID for one of the usb dr

Re: Checking for a mount in a shell script

2025-05-20 Thread Lee
On Tue, May 20, 2025 at 9:33 AM wrote: > > On Tue, May 20, 2025 at 09:30:37AM -0400, Lee wrote: > > On Tue, May 20, 2025 at 6:00 AM Jonathan Dowland wrote: > > > > > > On Tue May 20, 2025 at 6:41 AM BST, Kamil Jońca wrote: > > > > why not > > > > if ! mountpoint /mnt/usb-drive-b ; then ... > > > >

Re: Checking for a mount in a shell script

2025-05-20 Thread tomas
On Tue, May 20, 2025 at 09:30:37AM -0400, Lee wrote: > On Tue, May 20, 2025 at 6:00 AM Jonathan Dowland wrote: > > > > On Tue May 20, 2025 at 6:41 AM BST, Kamil Jońca wrote: > > > why not > > > if ! mountpoint /mnt/usb-drive-b ; then ... > > > ? > > > > I'd not heard of either `mountpoint` or `fin

Re: Checking for a mount in a shell script

2025-05-20 Thread Lee
On Tue, May 20, 2025 at 6:00 AM Jonathan Dowland wrote: > > On Tue May 20, 2025 at 6:41 AM BST, Kamil Jońca wrote: > > why not > > if ! mountpoint /mnt/usb-drive-b ; then ... > > ? > > I'd not heard of either `mountpoint` or `findmnt` before. I see they're > both part of util-linux, so I guess as

Re: Checking for a mount in a shell script

2025-05-20 Thread Jonathan Dowland
On Tue May 20, 2025 at 6:41 AM BST, Kamil Jońca wrote: why not if ! mountpoint /mnt/usb-drive-b ; then ... ? I'd not heard of either `mountpoint` or `findmnt` before. I see they're both part of util-linux, so I guess as likely as each other to be available (which is one criterion I would use

Re: Checking for a mount in a shell script

2025-05-19 Thread Kamil Jońca
Andy Smith writes: > Hi, > > On Sun, May 18, 2025 at 12:47:25PM -0400, Default User wrote: >> Since I know almost no shell scripting, the rsync usb drive A  >> to usb drive B copy is done with a simple bash script consisting >> only of the rsync backup command, with

Re: Checking for a mount in a shell script (Was: Re: Preparing for Debian 13)

2025-05-19 Thread Lee
M Andy Smith wrote: > > > > > > > > > > Hi, > > > > > > > > > > On Sun, May 18, 2025 at 12:47:25PM -0400, Default User wrote: > > > > > > Since I know almost no shell scripting, the rsync usb drive A > > > > > > to us

Re: Checking for a mount in a shell script (Was: Re: Preparing for Debian 13)

2025-05-19 Thread Dan Purgert
; > > On Sun, May 18, 2025 at 12:47:25PM -0400, Default User wrote: > > > > > Since I know almost no shell scripting, the rsync usb drive A > > > > > to usb drive B copy is done with a simple bash script consisting > > > > > only of the rsy

Re: Checking for a mount in a shell script (Was: Re: Preparing for Debian 13)

2025-05-19 Thread Lee
: > > > > Since I know almost no shell scripting, the rsync usb drive A > > > > to usb drive B copy is done with a simple bash script consisting > > > > only of the rsync backup command, with options and parameters, but > > > > without any code to veri

Re: Checking for a mount in a shell script (Was: Re: Preparing for Debian 13)

2025-05-18 Thread Greg Wooledge
> > to usb drive B copy is done with a simple bash script consisting > > > only of the rsync backup command, with options and parameters, but > > > without any code to verify that usb drive B is attached. > > > > If your backup script is a bash script then all you nee

Re: Checking for a mount in a shell script (Was: Re: Preparing for Debian 13)

2025-05-18 Thread Lee
On Sun, May 18, 2025 at 4:51 PM Andy Smith wrote: > > Hi, > > On Sun, May 18, 2025 at 12:47:25PM -0400, Default User wrote: > > Since I know almost no shell scripting, the rsync usb drive A > > to usb drive B copy is done with a simple bash script consisting > > on

Re: Checking for a mount in a shell script (Was: Re: Preparing for Debian 13)

2025-05-18 Thread Default User
Thanks, Andy! I'll give it a try.

Checking for a mount in a shell script (Was: Re: Preparing for Debian 13)

2025-05-18 Thread Andy Smith
Hi, On Sun, May 18, 2025 at 12:47:25PM -0400, Default User wrote: > Since I know almost no shell scripting, the rsync usb drive A  > to usb drive B copy is done with a simple bash script consisting > only of the rsync backup command, with options and parameters, but > without any co

Re: Script typeface.

2024-10-31 Thread debian-user
pe...@easthope.ca wrote: > From: debian-u...@howorth.org.uk > Date: Wed, 30 Oct 2024 22:06:02 + > > Have you looked at https://elementor.com/blog/handwriting-fonts/ ? > > Looked since you mentioned. The heading I cited appears to be > in Pacifico font. > > Elementor is charging us

Re: Script typeface.

2024-10-31 Thread peter
From: debian-u...@howorth.org.uk Date: Wed, 30 Oct 2024 22:06:02 + > Have you looked at https://elementor.com/blog/handwriting-fonts/ ? Looked since you mentioned. The heading I cited appears to be in Pacifico font. Elementor is charging us 50+ dollars/yr. I don't see a mention of

Re: Script typeface.

2024-10-31 Thread peter
From: Ash Joubert Date: Thu, 31 Oct 2024 12:26:39 +1300 > Try filtering Google Fonts by Calligraphy / > Handwritten. That gives 81 fonts to consider. Good, thx, ... P. -- VoIP: +1 604 670 0140 work: https://en.wikibooks.org/wiki/User:Pet

Re: Script typeface.

2024-10-30 Thread debian-user
pe...@easthope.ca wrote: > Hi, > > Apparently the page here was constructed using something called > Elementor. https://www.friendsofthegulfislands.ca > > The heading is in a script style of typeface. > > I'm interested to find a free, open source replacment font

Script typeface.

2024-10-30 Thread peter
Hi, Apparently the page here was constructed using something called Elementor. https://www.friendsofthegulfislands.ca The heading is in a script style of typeface. I'm interested to find a free, open source replacment font. Not necessarily the same in appearance but aesthetically approp

Re: Cleanup in a bash script

2024-10-03 Thread tomas
On Thu, Oct 03, 2024 at 03:19:09PM +0300, Anssi Saari wrote: > writes: > > > What actually happens seems completely different to me: the shell > > gets the EPIPE from the dying tee before it can see the EINTR, right? > > That depends. tee -i will ignore SIGINT but ./s

Re: Cleanup in a bash script

2024-10-03 Thread Anssi Saari
writes: > What actually happens seems completely different to me: the shell > gets the EPIPE from the dying tee before it can see the EINTR, right? That depends. tee -i will ignore SIGINT but ./script gets it. So it can keep writing in the pipe, from the script proper or its SIGINT handl

Re: Cleanup in a bash script

2024-10-02 Thread Nicolas George
Greg Wooledge (12024-10-02): > In that case, there are THREE foreground processes which receive a SIGINT: > > * The interactive shell, which ignores it, because interactive shells >always ignore SIGINT. You are very right on the rest, but this is a mistake: the interactive shell is not in th

Re: Cleanup in a bash script

2024-10-02 Thread tomas
On Wed, Oct 02, 2024 at 08:17:34AM -0400, Greg Wooledge wrote: [...] Thanks for your (as always) very exhaustive description. > What I'm mostly trying to convey here, though, is that signals do not > *propagate* from one process to another in any kind of automatic way. That's more or less what

Re: Cleanup in a bash script

2024-10-02 Thread Greg Wooledge
On Wed, Oct 02, 2024 at 13:59:04 +0200, to...@tuxteam.de wrote: > On Wed, Oct 02, 2024 at 02:43:11PM +0300, Anssi Saari wrote: > > Running ./script |& tee -i log works as expected. The script gets the > > INT signal and cleans up. > > Understood. > > > To me,

Re: Cleanup in a bash script

2024-10-02 Thread tomas
bvious solution to > Tim's problem, as he wrote: > > QUOTE > ./script |& tee log > > and now it doesn't clean up if I it." > END QUOTE > > Running ./script |& tee -i log works as expected. The script gets the > INT signal and cleans up. U

Re: Cleanup in a bash script

2024-10-02 Thread Anssi Saari
on trying to debug something else, I wanted to run it like this: >> >> > >> >> > ./script |& tee log >> >> > >> >> > and now it doesn't clean up if I it. >> >> >> >> Just a point here about tee since I didn't see an

Re: Cleanup in a bash script

2024-10-01 Thread tomas
On Tue, Oct 01, 2024 at 01:53:26PM +0300, Anssi Saari wrote: > Greg Wooledge writes: > > > On Mon, Sep 30, 2024 at 14:08:19 +0300, Anssi Saari wrote: > >> Tim Woodall writes: > >> > >> > However on trying to debug something else, I wanted to run it li

Re: Cleanup in a bash script

2024-10-01 Thread Anssi Saari
Greg Wooledge writes: > On Mon, Sep 30, 2024 at 14:08:19 +0300, Anssi Saari wrote: >> Tim Woodall writes: >> >> > However on trying to debug something else, I wanted to run it like this: >> > >> > ./script |& tee log >> > >> >

Re: Cleanup in a bash script

2024-09-30 Thread Tim Woodall
ing? In this particular case it's almost certain that the tee program will have gone away before the bash script calls the exit handler. That last sentence seems _very_ relevant here. If the other end of the pipe is gone, then the shell builtin `echo` probably fails with SIGPIPE/EPIPE. So will

Re: Cleanup in a bash script

2024-09-30 Thread Greg Wooledge
On Mon, Sep 30, 2024 at 14:08:19 +0300, Anssi Saari wrote: > Tim Woodall writes: > > > However on trying to debug something else, I wanted to run it like this: > > > > ./script |& tee log > > > > and now it doesn't clean up if I it. > > Ju

Re: Cleanup in a bash script

2024-09-30 Thread Anssi Saari
Tim Woodall writes: > However on trying to debug something else, I wanted to run it like this: > > ./script |& tee log > > and now it doesn't clean up if I it. Just a point here about tee since I didn't see anyone else mention it. tee has had the -i option to igno

Re: Cleanup in a bash script

2024-09-28 Thread Michael Kjörling
g? > > In this particular case it's almost certain that the tee program will > have gone away before the bash script calls the exit handler. That last sentence seems _very_ relevant here. If the other end of the pipe is gone, then the shell builtin `echo` probably fails with SIGPIPE

Re: Cleanup in a bash script

2024-09-28 Thread Tim Woodall
On Sat, 28 Sep 2024, Greg Wooledge wrote: On Sat, Sep 28, 2024 at 14:53:10 +0100, Tim Woodall wrote: Is there a way in bash to guarantee that a trap gets called for cleanup in a script? #!/bin/bash trap cleanup EXIT cleanup() { ... } This works in bash -- i.e., it calls the cleanup

Re: Cleanup in a bash script

2024-09-28 Thread Greg Wooledge
On Sat, Sep 28, 2024 at 15:17:47 +0100, Alain D D Williams wrote: > On Sat, Sep 28, 2024 at 10:13:59AM -0400, Greg Wooledge wrote: > > On Sat, Sep 28, 2024 at 14:53:10 +0100, Tim Woodall wrote: > > > Is there a way in bash to guarantee that a trap gets called for cleanup

Re: Cleanup in a bash script

2024-09-28 Thread Alain D D Williams
On Sat, Sep 28, 2024 at 10:13:59AM -0400, Greg Wooledge wrote: > On Sat, Sep 28, 2024 at 14:53:10 +0100, Tim Woodall wrote: > > Is there a way in bash to guarantee that a trap gets called for cleanup > > in a script? > > #!/bin/bash > trap cleanup EXIT > cleanup() { &g

Re: Cleanup in a bash script

2024-09-28 Thread Greg Wooledge
On Sat, Sep 28, 2024 at 14:53:10 +0100, Tim Woodall wrote: > Is there a way in bash to guarantee that a trap gets called for cleanup > in a script? #!/bin/bash trap cleanup EXIT cleanup() { ... } This works in bash -- i.e., it calls the cleanup function regardless of whether the shell

Re: Cleanup in a bash script

2024-09-28 Thread john doe
On 9/28/24 15:53, Tim Woodall wrote: Is there a way in bash to guarantee that a trap gets called for cleanup in a script? I have a script that works perfectly normally and cleans up after itself, even if it goes wrong. However on trying to debug something else, I wanted to run it like this

Cleanup in a bash script

2024-09-28 Thread Tim Woodall
Is there a way in bash to guarantee that a trap gets called for cleanup in a script? I have a script that works perfectly normally and cleans up after itself, even if it goes wrong. However on trying to debug something else, I wanted to run it like this: ./script |& tee log and now it doe

Re: OT: Question to shell script

2024-09-06 Thread Anssi Saari
Hans writes: > What I am exactly want to do: > > I have 5 live-build directories. In each I am starting my own script, which > is > setting variables and so on for the individual build and does some other > things (rennamin and copying the resulted ISO and so on). So you&#

Re: OT: Question to shell script

2024-09-06 Thread Hans
What I am exactly want to do: I have 5 live-build directories. In each I am starting my own script, which is setting variables and so on for the individual build and does some other things (rennamin and copying the resulted ISO and so on). As each build must be started within the live-build

Re: OT: Question to shell script

2024-09-06 Thread DdB
Am 06.09.2024 um 12:25 schrieb Hans: > Dear list, > > I am stuck with a little problem and know no one, whom I can ask. So I allow > me to ask here. > > I have several directories, and in each directory there is a shell script, > which MUST be started within and from

Re: OT: Question to shell script

2024-09-06 Thread Andy Smith
cd "$(dirname "$0")" > > https://mywiki.wooledge.org/BashFAQ/028 Ah, got it - $0 is not reliably the location of the running script. Thanks, Andy -- https://bitfolk.com/ -- No-nonsense VPS hosting

Re: OT: Question to shell script

2024-09-06 Thread Nicolas George
Andy Smith (12024-09-06): > cd "$(dirname "$0")" … || exit Regards, -- Nicolas George

Re: OT: Question to shell script

2024-09-06 Thread Greg Wooledge
On Fri, Sep 06, 2024 at 11:10:16 +, Andy Smith wrote: > Is there a reason not to just make these scripts cd to their own > directory so the caller doesn't have to care? > > cd "$(dirname "$0")" https://mywiki.wooledge.org/BashFAQ/028

Re: OT: Question to shell script

2024-09-06 Thread Greg Wooledge
On Fri, Sep 06, 2024 at 12:25:11 +0200, Hans wrote: > I have several directories, and in each directory there is a shell script, > which MUST be started within and from its path. I'm not clear on what "within and from its path" means here, but let's suppose you mean

Re: OT: Question to shell script

2024-09-06 Thread Andy Smith
Hi, On Fri, Sep 06, 2024 at 12:25:11PM +0200, Hans wrote: > I have several directories, and in each directory there is a shell script, > which MUST be started within and from its path. Is there a reason not to just make these scripts cd to their own directory so the caller doesn't h

OT: Question to shell script

2024-09-06 Thread Hans
Dear list, I am stuck with a little problem and know no one, whom I can ask. So I allow me to ask here. I have several directories, and in each directory there is a shell script, which MUST be started within and from its path. Now I want to edit a "master-shell-script", which I

Re: How to run automatically a script as soon root login

2024-05-14 Thread Greg Wooledge
On Tue, May 14, 2024 at 02:51:17PM +0200, Mario Marietto wrote: > I've installed the Cloudflare gateway on Debian as a vm because I can't do > it directly in FreeBSD. But I want to be covered even when I use FreeBSD. > The script that I wrote forward the Cloudflare "VPN&q

Re: How to run automatically a script as soon root login

2024-05-14 Thread Mario Marietto
I've installed the Cloudflare gateway on Debian as a vm because I can't do it directly in FreeBSD. But I want to be covered even when I use FreeBSD. The script that I wrote forward the Cloudflare "VPN" from Debian to FreeBSD,so from outside my IP will be cloudFlared. On Tu

Re: How to run automatically a script as soon root login

2024-05-14 Thread Greg Wooledge
On Tue, May 14, 2024 at 01:10:05PM +0200, Mario Marietto wrote: > Your answer does not help me to understand how to use a "structured > programming / if , while, for, functions" for the specific task that I want > to achieve. What task is that?

Re: How to run automatically a script as soon root login

2024-05-14 Thread Mario Marietto
different way,a modern way, for creating my script ? > Why > > did I feel so comfortable by recreating the 1960s GOTO statement in Bash > ? > > I have absolutely no clue what you're trying to do or why you're trying > to do it, but I *promise* you, whatever you thi

Re: How to run automatically a script as soon root login

2024-05-14 Thread Greg Wooledge
On Tue, May 14, 2024 at 08:09:18AM +0200, Mario Marietto wrote: > Nobody can show a different way,a modern way, for creating my script ? Why > did I feel so comfortable by recreating the 1960s GOTO statement in Bash ? I have absolutely no clue what you're trying to do or why you'

Re: sudo echo 1 > /proc/sys/net/ipv4/ip_forward [was: How to run automatically a script as soon root login]

2024-05-14 Thread tomas
On Tue, May 14, 2024 at 04:54:26PM +0800, Bret Busby wrote: > > Wasn't sudo echo the name of a pop group? > > :) If it wasn't it should've been one. Cheers -- t signature.asc Description: PGP signature

Re: sudo echo 1 > /proc/sys/net/ipv4/ip_forward [was: How to run automatically a script as soon root login]

2024-05-14 Thread Bret Busby
Wasn't sudo echo the name of a pop group? :) Bret Busby Armadale Western Australia (UTC+0800) .

Re: How to run automatically a script as soon root login

2024-05-13 Thread tomas
On Tue, May 14, 2024 at 08:09:18AM +0200, Mario Marietto wrote: > Nobody can show a different way,a modern way, for creating my script ? Why > did I feel so comfortable by recreating the 1960s GOTO statement in Bash ? I think your style is too alien to most of the people here to make the

Re: How to run automatically a script as soon root login

2024-05-13 Thread Mario Marietto
Nobody can show a different way,a modern way, for creating my script ? Why did I feel so comfortable by recreating the 1960s GOTO statement in Bash ? On Mon, May 13, 2024 at 6:30 PM Will Mengarini wrote: > Nobody has yet applauded this glorious implementation > of the 1960s GOTO statem

Re: sudo echo 1 > /proc/sys/net/ipv4/ip_forward [was: How to run automatically a script as soon root login]

2024-05-13 Thread tomas
On Mon, May 13, 2024 at 08:37:16PM +0200, Erwan David wrote: > Le 13/05/2024 à 19:45, Stefan Monnier a écrit : [...] > > % sudo zsh -l > > # echo 1 > /proc/sys/net/ipv4/ip_forward > > # ^D > > logout > > % > > > > 🙂 > > > > > > Stefan > > > > > sudo -i will

Re: How to run automatically a script as soon root login

2024-05-13 Thread Mario Marietto
> > > > > > Sorry, dumb question: Depending of the shell, the user is using > (let's > > > say, he > > > > will use bash), can the script not be added into ~/.bashrc? > > > > > > The context has been snipped out. The context for this was

Re: How to run automatically a script as soon root login

2024-05-13 Thread David Wright
y 13, 2024 at 07:36:07AM +0200, Richard wrote: > > > > > .profile > > > > > > Sorry, dumb question: Depending of the shell, the user is using (let's > > say, he > > > will use bash), can the script not be added into ~/.bashrc? > > > > The

Re: How to run automatically a script as soon root login

2024-05-13 Thread Mario Marietto
file > > > > Sorry, dumb question: Depending of the shell, the user is using (let's > say, he > > will use bash), can the script not be added into ~/.bashrc? > > The context has been snipped out. The context for this was "OP is trying > to run a command when r

Re: How to run automatically a script as soon root login

2024-05-13 Thread Greg Wooledge
s say, > he > will use bash), can the script not be added into ~/.bashrc? The context has been snipped out. The context for this was "OP is trying to run a command when root logs in". The method of login was not stated. First responder said ".profile works for every me

Re: sudo echo 1 > /proc/sys/net/ipv4/ip_forward [was: How to run automatically a script as soon root login]

2024-05-13 Thread Erwan David
Le 13/05/2024 à 19:45, Stefan Monnier a écrit : $ su - Password: # echo 1 > /proc/sys/net/ipv4/ip_forward # ^D logout $ I don't need no stinkin' sudo :-) And if you only have `sudo`, but not the root password, of course: % sudo zsh -l # echo 1 > /proc/sys/net/ipv4/ip_forward # ^

Re: sudo echo 1 > /proc/sys/net/ipv4/ip_forward [was: How to run automatically a script as soon root login]

2024-05-13 Thread tomas
On Mon, May 13, 2024 at 01:45:40PM -0400, Stefan Monnier wrote: > > $ su - > > Password: > > # echo 1 > /proc/sys/net/ipv4/ip_forward > > # ^D > > logout > > $ > > > > I don't need no stinkin' sudo :-) > > And if you only have `sudo`, but not the root password, of course: > > % sudo zsh -l >

Re: sudo echo 1 > /proc/sys/net/ipv4/ip_forward [was: How to run automatically a script as soon root login]

2024-05-13 Thread Stefan Monnier
> $ su - > Password: > # echo 1 > /proc/sys/net/ipv4/ip_forward > # ^D > logout > $ > > I don't need no stinkin' sudo :-) And if you only have `sudo`, but not the root password, of course: % sudo zsh -l # echo 1 > /proc/sys/net/ipv4/ip_forward # ^D logout % 🙂 Stefan

Re: sudo echo 1 > /proc/sys/net/ipv4/ip_forward [was: How to run automatically a script as soon root login]

2024-05-13 Thread Christian Groessler
On 5/13/24 18:52, to...@tuxteam.de wrote: Now share your ideas :-) $ su - Password: # echo 1 > /proc/sys/net/ipv4/ip_forward # ^D logout $ I don't need no stinkin' sudo :-) regards, chris

Re: How to run automatically a script as soon root login

2024-05-13 Thread Richard
>> If yes, second dumb question: Coiuld it be ANY script or command? >> (also running as non-rootuser, like adding "runuser -u myuser >> command_whatever"). >Root can do this, yes. Or to be more precise, .bashrc (and any file that's read from it like .bash_al

Re: How to run automatically a script as soon root login

2024-05-13 Thread Mario Marietto
I think I have found my way,adding this line to /etc/sudoers : marietto ALL=(ALL) NOPASSWD: /usr/bin/iptables and on the warp script : sudo /usr/bin/iptables -A POSTROUTING -t nat -s 192.168.1.5 -j MASQUERADE On Mon, May 13, 2024 at 3:20 PM wrote: > On Mon, May 13, 2024 at 09:17:31AM -0

sudo echo 1 > /proc/sys/net/ipv4/ip_forward [was: How to run automatically a script as soon root login]

2024-05-13 Thread tomas
Since this happens so often, I'm trying to offer a recap. As others have noted, the above sudo echo 1 > /proc/sys/net/ipv4/ip_forward won't work, since it runs echo under sudo, but the file opening (that pesky ">") happens in your shell, which is probably running unprivileged (otherwise, what

Re: How to run automatically a script as soon root login

2024-05-13 Thread Will Mengarini
l "$cmd" > exit > } Anyway, Marietto, you've got two typi: > mid : That should be "mid:". > jump foo That should be "jumpto foo". Once you've got your root-login script working, I hope you move on to implementing a complete open-source PL/I compiler.

Re: How to run automatically a script as soon root login

2024-05-13 Thread Richmond
Mario Marietto writes: > There is still a problem. If I login automatically as user and inside > the script I do this : > > sudo iptables -A POSTROUTING -t nat -s 192.168.1.5 -j MASQUERADE > > it asks me for the password (don't know why it didn't before) but I >

Re: How to run automatically a script as soon root login

2024-05-13 Thread Mario Marietto
I don't have those typos in the code. The typo has been to copy the content of the script by hand on the email message. On Mon, May 13, 2024 at 6:30 PM Will Mengarini wrote: > Nobody has yet applauded this glorious implementation > of the 1960s GOTO statement in *Bash*?! > >

Re: How to run automatically a script as soon root login

2024-05-13 Thread tomas
s say, > he > will use bash), can the script not be added into ~/.bashrc? Yes. Consult your shell's manual. And it will also depend on whether it is considered to be a "login shell". And on a couple of other factors. > If yes, second dumb question: Coiuld it be ANY scri

Re: How to run automatically a script as soon root login

2024-05-13 Thread Hans
Am Montag, 13. Mai 2024, 13:24:17 CEST schrieb Greg Wooledge: > On Mon, May 13, 2024 at 07:36:07AM +0200, Richard wrote: > > .profile Sorry, dumb question: Depending of the shell, the user is using (let's say, he will use bash), can the script not be added into ~/.bashrc? If ye

Re: How to run automatically a script as soon root login

2024-05-13 Thread Mario Marietto
ll a problem. If I login automatically as user and inside the > script I do this : > > sudo iptables -A POSTROUTING -t nat -s 192.168.1.5 -j MASQUERADE > > it asks me for the password (don't know why it didn't before) but I can't > issue a password,because the script i

Re: How to run automatically a script as soon root login

2024-05-13 Thread Mario Marietto
There is still a problem. If I login automatically as user and inside the script I do this : sudo iptables -A POSTROUTING -t nat -s 192.168.1.5 -j MASQUERADE it asks me for the password (don't know why it didn't before) but I can't issue a password,because the script inside the

Re: How to run automatically a script as soon root login

2024-05-13 Thread Stefan Monnier
> You don't need to, but I definitely think he does. 🙂 ^^ [ Oh, bias, when will you leave me alone? ] Stefan

Re: How to run automatically a script as soon root login

2024-05-13 Thread Mario Marietto
d. The same for until and for. Sorry for that,but I'm not an experienced coder. I try to do my best with what I find on the Internet. I can adapt an already good enough solution to fit my needs,but I'm not able to write a script from scratch. It is also true that I found it good because

Re: How to run automatically a script as soon root login

2024-05-13 Thread Stefan Monnier
>> > echo 1 > /proc/sys/net/ipv4/ip_forward >> This doesn't sound right. Maybe you should investigate why you're > No need to “investigate”, the answer is obvious: in You don't need to, but I definitely think he does. 🙂 Stefan

Re: How to run automatically a script as soon root login

2024-05-13 Thread Nicolas George
Mario Marietto (12024-05-13): > The command iptables -A POSTROUTING -t nat -s 192.168.1.5 -j MASQUERADE > doesn't work if invoked as a user,it says "you must be root". So,as > user,the script seems to be working fine like this : > > function jumpto > { >

Re: How to run automatically a script as soon root login

2024-05-13 Thread tomas
On Mon, May 13, 2024 at 09:17:31AM -0400, Greg Wooledge wrote: > On Mon, May 13, 2024 at 02:03:59PM +0100, Richmond wrote: > > >> sudo xterm -e "echo 1 > hello" > > > Yes, but why did it allow me to delete the file? I was not root > > then. Try it. > > Because you have write permission on the *di

Re: How to run automatically a script as soon root login

2024-05-13 Thread Erwan David
Le 13/05/2024 à 15:03, Richmond a écrit : Erwan David writes: Le 13/05/2024 à 14:36, Richmond a écrit : I was experimenting, and found this works: sudo xterm -e "echo 1 > hello" It created a file owned by root. But I found I was able to remove it without being root even though group and wor

Re: How to run automatically a script as soon root login

2024-05-13 Thread Greg Wooledge
On Mon, May 13, 2024 at 02:03:59PM +0100, Richmond wrote: > >> sudo xterm -e "echo 1 > hello" > Yes, but why did it allow me to delete the file? I was not root > then. Try it. Because you have write permission on the *directory* that the file is in. Removing (unlinking) a file is an operation th

Re: How to run automatically a script as soon root login

2024-05-13 Thread Mario Marietto
The command iptables -A POSTROUTING -t nat -s 192.168.1.5 -j MASQUERADE doesn't work if invoked as a user,it says "you must be root". So,as user,the script seems to be working fine like this : function jumpto { label=$1 cmd=$(sed -n "/$label:/{:a;n;

Re: How to run automatically a script as soon root login

2024-05-13 Thread Nicolas George
Richmond (12024-05-13): > sudo bash -c "echo 1 > hello" Use sh for that. Regards, -- Nicolas George

Re: How to run automatically a script as soon root login

2024-05-13 Thread Richmond
Erwan David writes: > Le 13/05/2024 à 14:36, Richmond a écrit : >> I was experimenting, and found this works: >> >> sudo xterm -e "echo 1 > hello" >> >> It created a file owned by root. But I found I was able to remove it >> without being root even though group and world permissions were read >>

Re: How to run automatically a script as soon root login

2024-05-13 Thread Richmond
writes: > On Mon, May 13, 2024 at 01:36:23PM +0100, Richmond wrote: >> I was experimenting, and found this works: >> >> sudo xterm -e "echo 1 > hello" > > That's like slicing your morning baguette with the chainsaw. I do that too. > > But if it works for you... hey :-) > > Cheers This also wo

Re: How to run automatically a script as soon root login

2024-05-13 Thread Dan Ritter
Richmond wrote: > I was experimenting, and found this works: > > sudo xterm -e "echo 1 > hello" > > It created a file owned by root. But I found I was able to remove it > without being root even though group and world permissions were read > only. The owner of a directory can delete any file in

Re: How to run automatically a script as soon root login

2024-05-13 Thread tomas
On Mon, May 13, 2024 at 02:53:18PM +0200, Nicolas George wrote: > to...@tuxteam.de (12024-05-13): > > That's like slicing your morning baguette with the chainsaw. > > Worse than that, it will only work from an X11 environment. Certainly > not at boot. The analogy to that would be that not many ki

Re: How to run automatically a script as soon root login

2024-05-13 Thread Nicolas George
to...@tuxteam.de (12024-05-13): > That's like slicing your morning baguette with the chainsaw. Worse than that, it will only work from an X11 environment. Certainly not at boot. Regards, -- Nicolas George

  1   2   3   4   5   6   7   8   9   10   >