- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: any way to give a cronjob a tty?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2009 12:21 PM
тАО03-30-2009 12:21 PM
Re: any way to give a cronjob a tty?
"Let's call the starting script start_sybase.sh in the script is:
${SYBHOME}/install/startserver -f ${SYBHOME}/install/RUN_TEST 2> /dev/null " &"
and you also mention (repeatedly) "/usr/bin/tty".
So: Is the "startserver" noted above a script or an executable?
You said: "Their resolution does not work because: /usr/bin/tty does not return a terminal. It returns, "not a tty". So it complains that it can't change the permissions on file "not".
What was their resolution? checking w/ /usr/bin/tty???
Why not log to a file, or does it still block?
If "startserver" is a script, this should be fixable, and relatively easily.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2009 12:34 PM
тАО03-30-2009 12:34 PM
Re: any way to give a cronjob a tty?
startserver is an executable of sybase's.
It is looking the tty this process has. It is verifying the that process owns that tty. If the cronjob has no tty, the starserver can't write to it. So it starts having problems.
When I run it interactively, there is a tty.
So there is no problem.
i will make it simple..............
IF I have a script that looks like this:
#!/bin/ksh
echo /usr/bin/tty
And I run it as a cronjob,
is there a way it can tell me something like
/dev/pts/6
instead of
"not a tty"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2009 12:52 PM
тАО03-30-2009 12:52 PM
Re: any way to give a cronjob a tty?
0. It is Friday at 3pm.
1. I log in as user sybase
2. I run job nohup ./watch_for_junk.sh &
3. I set up a cronjob to make an empty file called /home/sybase/start_it_up.txt at 2am Saturday morning.
4. I get out.
The program ./watch_for_junk.sh is still running and still (maybe?) has a terminal.
The program looks like this.....
#!/usr/bin/ksh
while [ 1 ]; do
if [ -f /home/sybase/start_it_up.txt ] ; then
startserver xxxxxxxxxxxxxxxxxx
...actually there would be tests to see if it is already up.
fi
sleep 300
done
I have a bad feeling about this. I'm expecting some shaking fingers.
I just got that wizard cap. I want to keep it.
What's wrong with this idea?
steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2009 01:00 PM
тАО03-30-2009 01:00 PM
SolutionIf you run as a crontask (or an 'at' task for that matter), then there is _no_ TTY associated with the process. This is why I used this test:
[ -t 0 ] && echo "I am interactive"
A deamonized process disassociates itself from any controlling TTY so that no signals sent to the initiating TTY process are seen by it.
A 'nohup' as a background job accomplishes some of the same functionally.
Whether or not your process is a shell script or a binary executable should not change the ability to do "nohup ... &",
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2009 02:33 PM
тАО03-30-2009 02:33 PM
Re: any way to give a cronjob a tty?
I'm very surprised that Sybase would have such a goofy bug.
Thank you all for the help. I'll figure some way around my problem.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2009 02:51 PM
тАО03-30-2009 02:51 PM
Re: any way to give a cronjob a tty?
What version of Sybase ASE are you having the problem with?
I am curious since we run 12.5.4 in a ServiceGuard environment where scripts su - sybase to start things. The DBAs are working on upgrading to 15.0.x. When I do a ps the TTY for the dataserver processes is a question mark.
Thanks,
Marlou
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2009 04:18 PM
тАО03-30-2009 04:18 PM
Re: any way to give a cronjob a tty?
There may be easier options, but we use this method to supply a tty to programs started by inetd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2009 06:43 PM
тАО03-30-2009 06:43 PM
Re: any way to give a cronjob a tty?
A tty is by definition an interactive (live human with a screen and keyboard). Are they saying you must provide a 24x7 on-call person to watch the screen whenever the database is restarted? Because this is so unusual, I think someone at Sybase has forgotten to tell the support the correct way to handle startserver's need for a real tty.
I'm not sure if Expect will cause a true tty to be be allocated, something where the tty command will return true.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2009 08:37 PM
тАО03-30-2009 08:37 PM
Re: any way to give a cronjob a tty?
I'm not sure this will help.
If you use "tty -s" it doesn't echo anything. You then can check the exit status and skip the chmod.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2009 10:48 PM
тАО03-30-2009 10:48 PM
Re: any way to give a cronjob a tty?
The correct way to fix this is to raise it as a bug with Sybase. There is _no_ way they can reasonably expect a database daemon process to always have a tty associated with it. At the very least their code should be checking the return code from tty, not just reading the response back off stdout. This is a bug, plain and simple...
That said, at this stage you need a workaround, and I'm not sure you are going to get one until you figure out *exactly* what startserver is doing.
If this were me I would be installing tusc on this system:
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/tusc-7.9/
And then looking to see how this call to tty is actually made... depending on that, I guess you might be able to alias tty to some other script which feeds something back to startserver, or alternatively create some sort of wrapper for tty which only comes into play when its called from your start script...
There are some options there, but you need to know what startserver is doing - getting tusc is a useful way to do that.
Still think this is a bug though...
HTH
Duncan
I am an HPE Employee