Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Writing and ssh script help
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Maximus2000
Tux's lil' helper
Tux's lil' helper


Joined: 07 Oct 2004
Posts: 127
Location: USA

PostPosted: Wed Feb 15, 2006 2:56 pm    Post subject: Writing and ssh script help Reply with quote

Hi,
I would like to write a script that would check to see if sshd is running. If it is not then have it start sshd and if it is do nothing. I would place this script into a cronstab and have it run every 30minutes. I need this to make sure that the remote machine I am supporting has ssh turned on at all times. I am not much of a script writer and that is why I am asking for some help.
_________________
Thanks
Maximus
Back to top
View user's profile Send private message
tagwar
Tux's lil' helper
Tux's lil' helper


Joined: 11 Aug 2004
Posts: 147
Location: Karlsruhe

PostPosted: Wed Feb 15, 2006 3:23 pm    Post subject: solved.. Reply with quote

Code:

#!/bin/bash
pidof sshd
if [ $? -ne 0 ]; then
/etc/init.d/sshd restart
fi


ugly but works....
Back to top
View user's profile Send private message
Maximus2000
Tux's lil' helper
Tux's lil' helper


Joined: 07 Oct 2004
Posts: 127
Location: USA

PostPosted: Wed Feb 15, 2006 6:04 pm    Post subject: Reply with quote

Thank you very much don't realy care if it is ugly or not.
_________________
Thanks
Maximus
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum