Hi to all ,
i wrote a small script and i add it to inittab to start the script during Startup. The script works fine , if i call it from the prompt but if it is call from inittab it is runnng too but it does not recognize system variable like USER , LOGNAME.
Since i running out of ideas i put inside the script source /.cshrc and source /etx/profile and source/etc/enviornment.
But this does not change anything the System variable still unkown
Those variables are set during user login and thus are only available in a user session.
During startup, no login shell is executed and no user is logged in (although root might be the owner of the startup processes). So, referring to those variables doesn't make any sense.
Does your crontab provide the @reboot time/date specifier?
To help you, we'd have to know a bit more about the script...
Who do you think runs the script in /etc/inittab ?
Let's say it must be oracle, and as we all kmow, oracle will not run like that, it needs loads of env variables set. Is it the case? as of course e.g. LOGNAME cannot be found as the script is launched by ? at boot time, so how do you expect that specific variable to be initialised when no login occured?...
In most cases it the use of su that solves the problem like using
In case when you need the same environment as in interactive mode ( login) you can use su - <user> at the condition you modified the .profile or whaterver profile you are using to bypass what is not used for batch mode : all that has to do with terminal settings etc... when in batch mode.
Those variables are set during user login and thus are only available in a user session.
During startup, no login shell is executed and no user is logged in (although root might be the owner of the startup processes). So, referring to those variables doesn't make any sense.
Does your crontab provide the @reboot time/date specifier?
Hi RudiC,
Thanks a lot for your reply
Sorry that i do not have much knowledge with AIX , I was not aware that this variables not available at boot up
I will come back to you when I am back in the office to answer your question
Thanks for your help
Kind regards
---------- Post updated at 08:15 PM ---------- Previous update was at 08:06 PM ----------
Quote:
Originally Posted by vbe
To help you, we'd have to know a bit more about the script...
Who do you think runs the script in /etc/inittab ?
Let's say it must be oracle, and as we all kmow, oracle will not run like that, it needs loads of env variables set. Is it the case? as of course e.g. LOGNAME cannot be found as the script is launched by ? at boot time, so how do you expect that specific variable to be initialised when no login occured?...
In most cases it the use of su that solves the problem like using
In case when you need the same environment as in interactive mode ( login) you can use su - <user> at the condition you modified the .profile or whaterver profile you are using to bypass what is not used for batch mode : all that has to do with terminal settings etc... when in batch mode.
Hi VBE,
Thanks for your reply
I did add the call to my script with mkittab and it works but the problems is with the variables
When I am back in office I will try your recommendation with su
I was expecting it will use root as user
when I login as user root the script works perfect
When back in the office I will post the script and the entry i made in inittab
Thanks for your support
With kind regards
when ich check it it is running with user root acount
---------- Post updated at 10:25 PM ---------- Previous update was at 10:09 PM ----------
Hi RudiC,
yes my crontab provide the Option @reboot , but i guest it will the same Problem that the user don''f have his full enviornment because it is in Batch mode. At the Moment it hat the call for my script in inittab , but i will try to put it now in crontab.
Kind regards
Thomas
Last edited by Corona688; 01-25-2017 at 05:19 PM..
OK, so at least we have established you are using AIX. Care to tel us which version? Issue:
to display it. Please post the output.
Quote:
Originally Posted by Nadielosabra
You should - under absolutely no circumstance - use csh at all. csh is bug-ridden to the extreme and is long deprecated, not to mention non-POSIX. Is there any factual reason why the script is in csh (other than "i didn't bother to learn any other)?
OK, so at least we have established you are using AIX. Care to tel us which version? Issue:
to display it. Please post the output.
You should - under absolutely no circumstance - use csh at all. csh is bug-ridden to the extreme and is long deprecated, not to mention non-POSIX. Is there any factual reason why the script is in csh (other than "i didn't bother to learn any other)?
I hope this helps.
bakunin
Hi Bakunin
Thanks a lot for your reply
I did post the oslevel already at my first post it is AIX 4.3
Thanks for your nice recommendation not to use the c shell ,I don't matter which shelll I am using as long I got the variables when I am in batch mode
That is the only thing I am care about
With kind redgards
Nadielosabra
Hi All,
I am booting by Linux box with the run level 3 and it gets booted successfully.
I want to execute a script once the system is up and running in the run level 3. I was trying to add a entry to /etc/inittab to execute my script once the system is up.
I have added the below... (5 Replies)
I am installing BusyBox on a device that does not have keyboard or serial connection, so I log into the system with SSH. I am in doubt about what to put in the inittab file. This is the content of the file:
::sysinit:/etc/init.d/rcS
::respawn:/bin/login
::shutdown:/sbin/swapoff -a... (1 Reply)
Today there was a situation where processes running from inittab was broken. Can someone help me understand, how to find out, who might have stopped those processes? Or how does it get broken?
G (2 Replies)
Hi
currently my linux instance is running in runlevel 3 ( someone has set the default to 3)
i have to change it to runlevel 5 . my question
1) does the editing of /etc/inittab needs system restart to enter runlevel 5.
2) how can we avoid system restart because if some users are... (3 Replies)
Hi,
I have a solaris 10 server,which has a process running that communicates with other system.I have made following entry in the inittab file.
PM15:s12345:respawn:/ncm/bin/communicator
PM15 : Unique process ID
s12345 : run levels
respawn : if anytime the process... (2 Replies)
Hi..
When i was just looking throught /etc/inittab file..
i had stuck with some problems that i dont known in shell scripts
Here how the lablel like
si
ca
lo
l1
etc works..
do scripts proivide any label features..
please help...
thanks in advance
esham (3 Replies)
Hi,
In Solaris 9 and below release we are using the rc script in inittab. I don't have much idea abt inittab in Solaris.
In Solris 9 and below:
We use rc3 script to start up the server. And we run database script before the rc3.
os:23:respawn:/etc/init.d/database start >/dev/null 2>&1... (7 Replies)
How do i get the value of the variable from the called script(script2) to the calling script(script1) in ksh ?
I've given portion of the script here to explain the problem.
Portion of Script 1
=============
-----
-----
tmp=`a.ksh p1 p2 p3`
if then
# error processing
fi
-----... (10 Replies)
Hi!
Is it possible to add more ttys in Solaris, like with inittab in Linux? I want to switch between the ttys with Alt F1+F2+F3 .... like Linux does.
How can i do this? (1 Reply)
Hi guys,
For some reason a client has given us a Sun Netra T1 with Solaris 8 to administer for them. That's always good business. However, the other day we rebooted the machine and to our amazement, after doing the preliminary hardware tests, we got an error messgae saying that /etc/inittab was... (3 Replies)