I have a Raspberry Pi that I'm trying to setup an incoming bash file to
toss incoming mail and also to run htick for any tic files. This is what
I have now...
#/bin/bash/inmail.sh
SBBSCTRL=/home/pi/sbbs/ctrl/sbbs.ini
export SBBSCTRL=/home/pi/sbbs/ctrl
Why if I'm telling it where the SBBSCRTL is and I getting the enviorment notset in the bash file?
Jeff Smith wrote to Bill Mcgarrity <=-
I have a Raspberry Pi that I'm trying to setup an incoming bash file to
toss incoming mail and also to run htick for any tic files. This is what
I have now...
#/bin/bash/inmail.sh
SBBSCTRL=/home/pi/sbbs/ctrl/sbbs.ini
[...]
export SBBSCTRL=/home/pi/sbbs/ctrl
[...]
Why if I'm telling it where the SBBSCRTL is and I getting the enviorment notset in the bash file?
First thing I see is a difference in the SBBSCTRL statements used.
Here I use "SBBSCTRL=/home/sbbs/ctrl" But in the home directory of the user the BBS will be running as you could edit the file named either .profile or .bash_profile depending on if you're running bash or sh and add the line:
SBBSCTRL=/home/sbbs/ctrl && export SBBSCTRL
In the above statement replace "/home/sbbs/ctrl" with the full path to your SBBS ctrl directory.
And regarding the BASH statement that you are using. Here I simply use "#!/bin/bash" as the first line of a bash script.
Jeff
--- BBBS/Li6 v4.10 Toy-3
* Origin: The OuijaBoard - Anoka, MN (1:282/1031)
Background....
I have a Raspberry Pi that I'm trying to setup an incoming bash file
to toss incoming mail and also to run htick for any tic files. This
is what I have now...
#/bin/bash/inmail.sh
SBBSCTRL=/home/pi/sbbs/ctrl/sbbs.ini
cd /home/pi/sbbs/exec
echo ***** Process inbound mail
sudo ./sbbsecho -LESRFD! > /home/pi/sbbs/events/inerror.log
cd /home/pi/husky/htick
sudo ./htick -c htick.cfg scan
#if exists [ /home/pi/sbbs/secure/*.tic ]
cd /home/pi/husky/htick
sudo ./htick -c htick.cfg toss
cd /home/pi/sbbs/exec
sudo ./addfiles * -sznf > /home/pi/sbbs/events/adderror.log
Why if I'm telling it where the SBBSCRTL is and I getting the
enviorment not set in the bash file?
SBBSCTRL=/home/pi/sbbs/ctrl/sbbs.iniset in the bash file?
[adderror.log]
SBBSCTRL environment variable not set.
Example: SET SBBSCTRL=/sbbs/ctrl
I also added the following to the /etc/profile
export SBBSCTRL=/home/pi/sbbs/ctrl
export SBBSNODE=/home/pi/sbbs/node1
Why if I'm telling it where the SBBSCRTL is and I getting the enviorment not
Accession wrote to Bill McGarrity <=-
Hello Bill,
On Tue Jan 24 2017 15:31:06, Bill McGarrity wrote to All:
Background....
I have a Raspberry Pi that I'm trying to setup an incoming bash file
to toss incoming mail and also to run htick for any tic files. This
is what I have now...
#/bin/bash/inmail.sh
SBBSCTRL=/home/pi/sbbs/ctrl/sbbs.ini
Try 'export SBBSCTRL=/home/pi/sbbs/ctrl' and you'll have better
results.
cd /home/pi/sbbs/exec
echo ***** Process inbound mail
sudo ./sbbsecho -LESRFD! > /home/pi/sbbs/events/inerror.log
cd /home/pi/husky/htick
sudo ./htick -c htick.cfg scan
[ CUT BELOW HERE ]
#if exists [ /home/pi/sbbs/secure/*.tic ]
cd /home/pi/husky/htick
sudo ./htick -c htick.cfg toss
[ INSTEAD ]
You may want to use an if/then/else statement here, like so:
if [ -f /home/pi/sbbs/secure/*.tic ]; then
sudo ./htick -c htick.cfg toss
else
Why if I'm telling it where the SBBSCRTL is and I getting the
enviorment not set in the bash file?
Because in your script you set the SBBSCTRL environment variable to sbbs.ini, and not the CTRL directory where it should be.
John Guillory wrote to BILL MCGARRITY <=-
SBBSCTRL=/home/pi/sbbs/ctrl/sbbs.ini
[adderror.log]ot
SBBSCTRL environment variable not set.
Example: SET SBBSCTRL=/sbbs/ctrl
I also added the following to the /etc/profile
export SBBSCTRL=/home/pi/sbbs/ctrl
export SBBSNODE=/home/pi/sbbs/node1
Why if I'm telling it where the SBBSCRTL is and I getting the enviorment
set in the bash file?
See above, you originally set the SBBSCTRL to the sbbs.ini file, not the directory. While you setup to export the SBBSCTRL environment variable properly in your profile, you said you set it up originally to point to the sbbs.ini file. Did you logoff then login again to re-read the profile file, once you edited it?
Hiya Nick...Add I believe it'd be: echo %SBBSCTRL% to your profile script.
Accession wrote to Bill McGarrity <=-I've tried everything... still nothing. I've tried all the suggestions and still get enviorment variable not set.
cd /home/pi/sbbs/exec
echo ***** Process inbound mail
sudo ./sbbsecho -LESRFD! > /home/pi/sbbs/events/inerror.log
Hiya John...
John Guillory wrote to BILL MCGARRITY <=-
SBBSCTRL=/home/pi/sbbs/ctrl/sbbs.ini
As stated above, I made the change in the script. I also rechecked the /etc/profile in root, the /home/pi/.profile and the /home/pi/.bash_profileand
added the lines you stated... still getting SBBSCtrl enviorment variable not set. :(/etc/.profile should be the profile that gets ran for every user, /root/.profile would be for the root account, which is what's getting
--
Bill
Telnet: tequilamockingbirdonline.net
Web: bbs.tequilamockingbirdonline.net:81
FTP: ftp.tequilamockingbirdonline.net:2121
IRC: irc.tequilamockingbirdonline.net Ports: 6661-6670 SSL: +6697
Radio: radio.tequilamockingbirdonline.net:8010/live
... Look Twice... Save a Life!!! Motorcycles are Everywhere!!!---
--- MultiMail/Win32 v0.50
.n * .gSynchronet.n * TequilaMockingbird Online - Toms River, NJ
#/bin/bash/inmail.sh
sudo ./sbbsecho -LESRFD! > /home/pi/sbbs/events/inerror.log
I also added the following to the /etc/profile
#/bin/bash/inmail.sh
#!/bin/bashaway
sudo ./sbbsecho -LESRFD! > /home/pi/sbbs/events/inerror.log
How is this script being called, and as what user? I suspect you could do
with sudo, though maybe some permissions need to be tweaked. (Since you're getting output from sbbsecho in your log, that implies sudo is working; I'm just wondering.)The sudo command implies that the sbbsecho gets called by root,
How is this script being called, and as what user? I suspect you
could do away with sudo, though maybe some permissions need to be
The sudo command implies that the sbbsecho gets called by root,
which is why I recommended him make sure he modifed /root/.profile or /root/.bashprofile ...
sudoThe sudo command implies that the sbbsecho gets called by root,
No kidding.
I was curious to know what user account the script was running under. For
to actually work in a script without a password prompt, he'd have to havetaken
some extra steps.making
which is why I recommended him make sure he modifed /root/.profile or /root/.bashprofile ...
Sure. At a glance it doesn't look like this stuff should need to be run as root, though.
I suspect the best fix for his problems will come down to .bash_profile,
sure the script runs in bash, and sorting out permissions so that it canjust
run as a regular user.I had similiar problems when running SBBS on my linode, I had to
Not that it really matters if he wants to go wild and run everything asroot:
https://www.garyshood.com/root/I'll have to check it out...
I had similiar problems when running SBBS on my linode, I had to constantly chown sbbs /sbbs to keep from getting errors writing to file and message directories, even then, I'd get problems, so finally I
decided to run the BBS as root....
https://www.garyshood.com/root/I'll have to check it out...
echicken wrote to Bill McGarrity <=-
#/bin/bash/inmail.sh
I don't do much shell scripting, but I'm wondering what the purpose of that line is. Also, do you have a line like this at the start of the script?
#!/bin/bash
sudo ./sbbsecho -LESRFD! > /home/pi/sbbs/events/inerror.log
How is this script being called, and as what user? I suspect you could
do away with sudo, though maybe some permissions need to be tweaked. (Since you're getting output from sbbsecho in your log, that implies
sudo is working; I'm just wondering.)
I also added the following to the /etc/profile
This brings me back to the shebang line (#!/bin/bash) that should be at the top of the script to identify which interpreter is used. It's possible that this script is being run by something else (sh perhaps)
that doesn't pay attention to /etc/profile. (I don't know enough to
say which do and don't.)
There are also situations where /etc/profile isn't used, so you may
need to export the SBBSCTRL variable from within the user's ~/.bash_profile file.
John Guillory wrote to ECHICKEN <=-
I had similiar problems when running SBBS on my linode, I had to constantly chown sbbs /sbbs to keep from getting errors writing to
file and message directories, even then, I'd get problems, so finally I decided to run the BBS as root....
echicken wrote to John Guillory <=-
I've been running my BBS on linux for quite a few years now (on linode
for part of that time - thankfully there are decent, cheaper
alternatives now) and have not had those sorts of problems. Normally
it's just a matter of specifying the right user and group in the [Unix] section of sbbs.ini.
However if you're running any external tools that create or modify
files (say a scanner/tosser as a cron job), it's good to run them as
the same user your BBS runs as, or ensure that group membership and permissions are set accordingly.
https://www.garyshood.com/root/I'll have to check it out...
It's just something of a joke page; mildly amusing and I'm reminded of
it whenever this sort of topic comes up.
I just use the BBS user's crontab for all cron jobs on my system, works fine.
SBBSCTRL=/home/pi/sbbs/ctrl/sbbs.ini
Try 'export SBBSCTRL=/home/pi/sbbs/ctrl' and you'll have better
results.
I've tried everything... still nothing. I've tried all the
suggestions and still get enviorment variable not set.
I even removed everything at the end so it doesn't post to a log and nadda... but it did come up on the screen...
You may want to use an if/then/else statement here, like so:
if [ -f /home/pi/sbbs/secure/*.tic ]; then
sudo ./htick -c htick.cfg toss
else
Done.... works perfectly... thank you..
Why if I'm telling it where the SBBSCRTL is and I getting the
enviorment not set in the bash file?
Because in your script you set the SBBSCTRL environment variable
to sbbs.ini, and not the CTRL directory where it should be.
I changed that as I said. Nadda... :/
Please read my reply to John...
SBBSCTRL=/home/pi/sbbs/ctrl/sbbs.ini
This I orginally put in the script itself. I have since removed the sbbs.ini and it's still doing the same thing.
export SBBSCTRL=/home/pi/sbbs/ctrl
export SBBSNODE=/home/pi/sbbs/node1
As stated above, I made the change in the script. I also rechecked
the /etc/profile in root, the /home/pi/.profile and the /home/pi/.bash_profile and added the lines you stated... still getting SBBSCtrl enviorment variable not set. :(
should be the profile that gets ran for every user, /root/.profile
would be for the root account, which is what's getting ran as using
sudo ... Try editing the /root/,profile or /root/.bash_profile and
see if that helps...
Accession wrote to Bill McGarrity <=-
On Wed Jan 25 2017 16:54:00, Bill McGarrity wrote to John Guillory:
SBBSCTRL=/home/pi/sbbs/ctrl/sbbs.ini
This I orginally put in the script itself. I have since removed the sbbs.ini and it's still doing the same thing.
And with or without sbbs.ini, the command is wrong without "export" at
the beginning, just like you seemed to have put into your /etc/profile below..
export SBBSCTRL=/home/pi/sbbs/ctrl
export SBBSNODE=/home/pi/sbbs/node1
As stated above, I made the change in the script. I also rechecked
the /etc/profile in root, the /home/pi/.profile and the /home/pi/.bash_profile and added the lines you stated... still getting SBBSCtrl enviorment variable not set. :(
Maybe not enough changes in your script?
Adding it to .profile and .bash_profile is unnecessary. /etc/profile is system-wide, and anything starting with a period in your home directory
is for that user only, and not system-wide.
@VIA: ECBBS(say a
However if you're running any external tools that create or modify files
scanner/tosser as a cron job), it's good to run them as the same user yourBBS
runs as, or ensure that group membership and permissions are setaccordingly.
Way too funny! Demanding that VLC removed their idiotic andhttps://www.garyshood.com/root/I'll have to check it out...
It's just something of a joke page; mildly amusing and I'm reminded of it whenever this sort of topic comes up.
echicken wrote to Tony Langdon <=-
I just use the BBS user's crontab for all cron jobs on my system, works fine.
Yep, that's usually the way to go. I tend to use Synchronet's own
timed events when possible; requires a little less extra setup if you
move your BBS to another machine (not that it comes up often).
The issue was with "sudo".... I removed it and poof!!
Adding it to .profile and .bash_profile is unnecessary.
/etc/profile is system-wide, and anything starting with a period
in your home directory is for that user only, and not
system-wide.
Yes, it is added in the /etc/profile as you originally told me.
That's why I was confused it wouldn't find it but as I said to
echicken, removing sudo did the trick!!
@VIA: PHARCYDEBecause root doesn't run /etc/.profile!
Yes, it is added in the /etc/profile as you originally told me.
That's why I was confused it wouldn't find it but as I said to echicken, removing sudo did the trick!!
John Guillory wrote to ACCESSION <=-
@MSGID: <588A9C1E.6376.2syncsyso@tequilamockingbirdonline.net>
@VIA: PHARCYDE
Yes, it is added in the /etc/profile as you originally told me.Because root doesn't run /etc/.profile!
That's why I was confused it wouldn't find it but as I said to echicken, removing sudo did the trick!!
Because root doesn't run /etc/.profile!
needJohn Guillory wrote to ACCESSION <=-
Yes, it is added in the /etc/profile as you originally told me. That's why I was confused it wouldn't find it but as I said to echicken, removing sudo did the trick!!Because root doesn't run /etc/.profile!
Actually from reading the /etc/profile, it's universal for all users so no
for the /.profile you spoke of.
Then explain why removing the sudo fixed his problem with the
environment variable not being found! I double-dog-dare you to put a
line in your /etc/profile that says echo "I'm an idiot" then log in
as root and see if it displays....
Because root doesn't run /etc/.profile!
Actually from reading the /etc/profile, it's universal for all users
so no need for the /.profile you spoke of.
Then explain why removing the sudo fixed his problem with the
environment variable not being found! I double-dog-dare you to put a
line in your /etc/profile that says echo "I'm an idiot" then log in as root and see if it displays....
"export".SBBSCTRL=/home/pi/sbbs/ctrl/sbbs.ini
Try 'export SBBSCTRL=/home/pi/sbbs/ctrl' and you'll have better
results.
I've tried everything... still nothing. I've tried all the
suggestions and still get enviorment variable not set.
Apparantly, you missed something. In your line above, there is no
Is that still an issue that may have been overlooked?
@VIA: PHARCYDEBecause root doesn't run /etc/.profile!
Yes, it is added in the /etc/profile as you originally told me. That's why I was confused it wouldn't find it but as I said to echicken, removing sudo did the trick!!
me.Yes, it is added in the /etc/profile as you originally told
That's why I was confused it wouldn't find it but as I said to echicken, removing sudo did the trick!!Because root doesn't run /etc/.profile!
Actually from reading the /etc/profile, it's universal for all users sono need -> for the /.profile you spoke of.
Then explain why removing the sudo fixed his problem with the
environment variable not being found!
I double-dog-dare you to put a line in your /etc/profile that says
echo "I'm an idiot" then log in as root and see if it displays....
Then explain why removing the sudo fixed his problem with the
environment variable not being found! I double-dog-dare you to put a
line in your /etc/profile that says echo "I'm an idiot" then log in
as root and see if it displays....
LOL.... it's working now... I dare not fly in the face of success.... :)
LOL.... it's working now... I dare not fly in the face of success.... :)
but you should learn why it works now and didn't before ;)
LOL.... it's working now... I dare not fly in the face of
success.... :)
but you should learn why it works now and didn't before ;)
It was do to the 'sudo' before the ./sbbsecho from the testing I did.
It was do to the 'sudo' before the ./sbbsecho from the testing I did.
yes but why? why did "sudo" do that?? that's the part to be learned
and understood ;)
It was do to the 'sudo' before the ./sbbsecho from the testing Idid.
yes but why? why did "sudo" do that?? that's the part to be learned
and understood ;)
As I understand it... sudo allows anyone to become a superuser and
being I was running under 'pi', it would not allow the variable to be
set properly. Being /etc/profile already has it set for all users...
that was creating an issue. That's the way I see it... could be
wrong... yes?? no???
mark lewis wrote to Bill McGarrity <=-
On 2017 Jan 28 23:43:02, you wrote to me:
It was do to the 'sudo' before the ./sbbsecho from the testing Idid.
yes but why? why did "sudo" do that?? that's the part to be learned
and understood ;)
As I understand it... sudo allows anyone to become a superuser and
being I was running under 'pi', it would not allow the variable to be
set properly. Being /etc/profile already has it set for all users...
that was creating an issue. That's the way I see it... could be
wrong... yes?? no???
i'm trying to gently push you to the sudo docs where it is explained ;)
-E, --preserve-env
Indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may return an
error if the user does not have permission to preserve the environment.
-i, --login
Run the shell specified by the target user's password database entry as
a login shell. This means that login-specific resource files such as .profile or .login will be read by the shell. If a command is
specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed. sudo attempts to change to that user's home directory before running
the shell. The command is run with an environment similar to the one a user would receive at log in. The Command Environment section in the sudoers(5) manual documents how the -i option affects the environment
in which a command is run when the sudoers policy is in use.
plus i posted some links the other day explaining the environment thing with sudo...
but the main point is that you found out that you didn't even need to execute sudo to start with... not sure what made you think that you
needed to do that but you learned something from it ;)
| Sysop: | Winzlo |
|---|---|
| Location: | Minnesota, USA |
| Users: | 11 |
| Nodes: | 16 (0 / 16) |
| Uptime: | 495932:23:02 |
| Calls: | 82 |
| Files: | 1,070 |
| D/L today: |
27 files (11,920K bytes) |
| Messages: | 286,901 |