Re: [PLUG] Run crontab script using sudo

2024-01-02 Thread Rich Shepard

On Tue, 2 Jan 2024, Paul Heinlein wrote:


As Galen noted, it's "man 5 crontab." I specified it because many systems
have two crontab man pages, one in section 1, the other in section 5. The
section 1 page becomes the default.


Paul,

I don't have a crontab manual in section 5. And what I was seeking was how
to use /etc/cron.d/, which you've show me below.


No. Keep your update-tlmgr.sh script where it is.


Good it's in ~/shell-scripts/


Your /etc/cron.d fragment might be something like this
# /etc/cron.d/update-tlmgr.cron
27 05 * * * tlmgruser /path/to/update-tlmgr.sh


Got it. There is now a file update-tlmgr.cron in /etc/cron.d/.

Much appreciated!

Regards,

Rich


Re: [PLUG] Run crontab script using sudo

2024-01-02 Thread Paul Heinlein

On Tue, 2 Jan 2024, Rich Shepard wrote:


On Tue, 2 Jan 2024, Paul Heinlein wrote:


 The Linux distributions I use all have an /etc/cron.d directory that
 allows you to run scripts under any UID, no sudo required.


Paul,

Yes, Slackware has an /etc/cron.d directory.


 The modified crontab entries for snippets in that directory are documented
 in the crontab(5) man page, at least on my systems.


When I run `man crontab(5)' nothing happens:
$ man crontab(5)
-bash: syntax error near unexpected token `('


As Galen noted, it's "man 5 crontab." I specified it because many 
systems have two crontab man pages, one in section 1, the other in 
section 5. The section 1 page becomes the default.



My web searches for cron.d examples found 1 entry specific to debian and
ubuntu.

This is my update-tlmgr.sh:
cd /usr/local/texlive/2023/bin/x86_64-linux/
tlmgr update --self --all
fmtutil-sys --sys -all
cd

Do I put that script in the now empty /etc/cron.d/?


No. Keep your update-tlmgr.sh script where it is.

Your /etc/cron.d fragment might be something like this

# /etc/cron.d/update-tlmgr.cron
27 05 * * * tlmgruser /path/to/update-tlmgr.sh

Please note that "tlmgruser" is just a placeholder for the sake of 
discussion. I don't know what user you want to run that script. It 
might be root, or it might be a Slackware-specific users.


--
Paul Heinlein
heinl...@madboa.com
45°22'48" N, 122°35'36" W


Re: [PLUG] Run crontab script using sudo

2024-01-02 Thread Rich Shepard

On Tue, 2 Jan 2024, Galen Seitz wrote:


The syntax is:
man section_number something_to_lookup
so
man 5 crontab


galen,

It's been so long I've needed to specify a section I had to look for the
syntax and didn't find the proper one.

Many thanks,

Rich


Re: [PLUG] Run crontab script using sudo

2024-01-02 Thread Galen Seitz

On 1/2/24 08:46, Rich Shepard wrote:

On Tue, 2 Jan 2024, Paul Heinlein wrote:


The Linux distributions I use all have an /etc/cron.d directory that
allows you to run scripts under any UID, no sudo required.


Paul,

Yes, Slackware has an /etc/cron.d directory.

The modified crontab entries for snippets in that directory are 
documented

in the crontab(5) man page, at least on my systems.


When I run `man crontab(5)' nothing happens:
$ man crontab(5)
-bash: syntax error near unexpected token `('

`man crond' tells me how to run the daemon.


The syntax is:
man section_number something_to_lookup

so

man 5 crontab


galen
--
Galen Seitz
gal...@seitzassoc.com


Re: [PLUG] Run crontab script using sudo

2024-01-02 Thread Rich Shepard

On Tue, 2 Jan 2024, Paul Heinlein wrote:


The Linux distributions I use all have an /etc/cron.d directory that
allows you to run scripts under any UID, no sudo required.


Paul,

Yes, Slackware has an /etc/cron.d directory.


The modified crontab entries for snippets in that directory are documented
in the crontab(5) man page, at least on my systems.


When I run `man crontab(5)' nothing happens:
$ man crontab(5)
-bash: syntax error near unexpected token `('

`man crond' tells me how to run the daemon.

My web searches for cron.d examples found 1 entry specific to debian and
ubuntu.

This is my update-tlmgr.sh:
cd /usr/local/texlive/2023/bin/x86_64-linux/
tlmgr update --self --all
fmtutil-sys --sys -all
cd

Do I put that script in the now empty /etc/cron.d/?

I'll ask on the slackware mail list how to do this.

Thanks,

Rich



Re: [PLUG] Run crontab script using sudo

2024-01-02 Thread Paul Heinlein

On Tue, 2 Jan 2024, Rich Shepard wrote:

I've added my username to /etc/sudoers. I have a script that needs 
to run using sudo with a user rather than by root. When I run the 
script's commands in a console I enter my password when requested by 
sudo. How can I have the script provide the password? Or, do I 
modify /etc/sudoers to allow me to run these commands without a 
password?


The Linux distributions I use all have an /etc/cron.d directory that 
allows you to run scripts under any UID, no sudo required.


The modified crontab entries for snippets in that directory are 
documented in the crontab(5) man page, at least on my systems.


--
Paul Heinlein
heinl...@madboa.com
45°22'48" N, 122°35'36" W


[PLUG] Run crontab script using sudo

2024-01-02 Thread Rich Shepard

I've added my username to /etc/sudoers. I have a script that needs to run
using sudo with a user rather than by root. When I run the script's commands
in a console I enter my password when requested by sudo. How can I have the
script provide the password? Or, do I modify /etc/sudoers to allow me to run
these commands without a password?

TIA,

Rich