Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #67737
| From | Rich <rich@example.invalid> |
|---|---|
| Newsgroups | comp.os.linux.misc, comp.sys.raspberry-pi |
| Subject | Re: Simple way for web to execute root shell script. |
| Date | 2025-05-24 02:13 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <100ra17$bv9e$1@dont-email.me> (permalink) |
| References | <100pphq$2taj$2@dont-email.me> <100qfmc$78ks$3@dont-email.me> <100qmo3$8ldq$1@dont-email.me> |
Cross-posted to 2 groups.
In comp.os.linux.misc The Natural Philosopher <tnp@invalid.invalid> wrote: > On 23/05/2025 19:44, Rich wrote: >> In comp.os.linux.misc The Natural Philosopher <tnp@invalid.invalid> wrote: >>> I have a shell script that monitors hardware stuff - it needs to run >>> as root and be called by Apache as user www. >>> >>> Bookworm linux on a Pi4. >>> >>> Its all inside a domestic firewall so security is not a huge issue. >>> What is the quickest and simplest solution to this? >> >> You've been given lots of options already. But not this one. >> >> What "hardware stuff" is it monitoring? If it is reading files in >> /proc and/or /sys to obtain its "data" then another alternative would >> be to setup /proc and /sys to be mounted group or world readable (or to >> reset permissions on the necessary files via a rc.local boot script to >> group or world readable). That would let the script "monitor" without >> being root. Then you could even convert the script into a CGI script >> (which Apache is more than able to execute, and doing so for minimal >> text output involves the script outputting a handful of HTTP headers >> before the monitor data) and get your "monitoring data" back via >> Apache. >> > Sadly the data is not available in /sys or /proc AFAIK. Yeah, at least the smart data is not (as far as I am aware) available via /proc or /sys. Another option. You could setup a cronjob, as root, to run your script on some periodic basis (once per minute, every 10 minutes, etc.) and save the results into a file that is readable via the 'www' user (or to save the info directly into a file in the Apache htdocs hierarchy from where you want to retreive it). Then you can 'pull' the data via Apache from that file. You'd have data that is up to date as of the last run of the script, but you would not have the "exactly now it is Y" aspect (unless your AJAX pulled just after a cronjob run *and* you were watching the 'meters' at that very moment). You could even include a "date" as the first line, so you could see if something got hung by the time value being too far in the past.
Back to comp.os.linux.misc | Previous | Next — Previous in thread | Next in thread | Find similar
Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-23 13:26 +0100
Re: Simple way for web to execute root shell script. Pancho <Pancho.Jones@protonmail.com> - 2025-05-23 13:51 +0100
Re: Simple way for web to execute root shell script. Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2025-05-23 14:47 +0000
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-23 16:06 +0100
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-23 16:00 +0100
Re: Simple way for web to execute root shell script. Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2025-05-23 14:08 +0000
Re: Simple way for web to execute root shell script. Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2025-05-23 14:23 +0000
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-23 16:03 +0100
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-23 16:02 +0100
Re: Simple way for web to execute root shell script. Marc Haber <mh+usenetspam1118@zugschl.us> - 2025-05-23 17:24 +0200
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-23 17:53 +0100
Re: Simple way for web to execute root shell script. Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-05-24 00:37 +0000
Re: Simple way for web to execute root shell script. John-Paul Stewart <jpstewart@personalprojects.net> - 2025-05-23 10:14 -0400
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-23 16:05 +0100
Re: Simple way for web to execute root shell script. Eli the Bearded <*@eli.users.panix.com> - 2025-05-23 16:46 +0000
Re: Simple way for web to execute root shell script. Rich <rich@example.invalid> - 2025-05-23 18:44 +0000
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-23 21:44 +0100
Re: Simple way for web to execute root shell script. Rich <rich@example.invalid> - 2025-05-24 02:13 +0000
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-24 09:18 +0100
Re: Simple way for web to execute root shell script. Theo <theom+news@chiark.greenend.org.uk> - 2025-05-24 08:27 +0100
Re: Simple way for web to execute root shell script. Chris Elvidge <chris@internal.net> - 2025-05-24 13:28 +0100
Re: Simple way for web to execute root shell script. Anssi Saari <anssi.saari@usenet.mail.kapsi.fi> - 2025-05-25 10:17 +0300
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-25 08:52 +0100
Re: Simple way for web to execute root shell script. Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-05-25 09:42 +0000
Re: Simple way for web to execute root shell script. vallor <vallor@cultnix.org> - 2025-05-29 03:04 +0000
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-29 12:03 +0100
Re: Simple way for web to execute root shell script. Anssi Saari <anssi.saari@usenet.mail.kapsi.fi> - 2025-05-26 11:27 +0300
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-26 12:31 +0100
Re: Simple way for web to execute root shell script. druck <news@druck.org.uk> - 2025-05-27 21:44 +0100
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-28 08:58 +0100
Re: Simple way for web to execute root shell script. druck <news@druck.org.uk> - 2025-05-28 21:34 +0100
Re: Simple way for web to execute root shell script. Anssi Saari <anssi.saari@usenet.mail.kapsi.fi> - 2025-05-29 10:07 +0300
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-29 12:14 +0100
Re: Simple way for web to execute root shell script. Anssi Saari <anssi.saari@usenet.mail.kapsi.fi> - 2025-05-30 20:53 +0300
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-30 19:36 +0100
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-29 11:36 +0100
Re: Simple way for web to execute root shell script. Rich <rich@example.invalid> - 2025-05-29 14:41 +0000
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-29 18:47 +0100
Re: Simple way for web to execute root shell script. druck <news@druck.org.uk> - 2025-05-23 22:17 +0100
Re: Simple way for web to execute root shell script. Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-05-23 23:11 +0000
Re: Simple way for web to execute root shell script. c186282 <c186282@nnada.net> - 2025-05-24 01:43 -0400
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-24 09:20 +0100
Re: Simple way for web to execute root shell script. Richard Kettlewell <invalid@invalid.invalid> - 2025-05-24 10:58 +0100
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-24 11:27 +0100
Re: Simple way for web to execute root shell script. Eli the Bearded <*@eli.users.panix.com> - 2025-05-24 17:55 +0000
Re: Simple way for web to execute root shell script. Richard Kettlewell <invalid@invalid.invalid> - 2025-05-24 19:24 +0100
Re: Simple way for web to execute root shell script. Rich <rich@example.invalid> - 2025-05-24 15:41 +0000
Re: Simple way for web to execute root shell script. Andrew Smallshaw <andrews@sdf.org> - 2025-05-24 17:35 +0000
Re: Simple way for web to execute root shell script. Fritz Wuehler <fritz@spamexpire-202505.rodent.frell.theremailer.net> - 2025-05-24 23:34 +0200
Re: Simple way for web to execute root shell script. Dominik Ałaszewski <Dominik.Alaszewski@gazeta.pl.invalid> - 2025-05-26 17:24 +0000
Re: Simple way for web to execute root shell script. The Natural Philosopher <tnp@invalid.invalid> - 2025-05-26 20:44 +0100
Re: Simple way for web to execute root shell script. Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-05-26 22:22 +0000
Re: Simple way for web to execute root shell script. c186282 <c186282@nnada.net> - 2025-05-27 01:48 -0400
csiph-web