Programming :: Make A Script That Will Check Service/s Status Whether Running Or Stop?
Sep 6, 2010how to make a script that will check service/s status whether running or stop and also will run stop services?
View 9 Replieshow to make a script that will check service/s status whether running or stop and also will run stop services?
View 9 RepliesI have six linux Centos 5.0 Servers. I had to configure the snmp client. I just created a pretty basic configuration snmpd.conf file
Code: rocommunity CompanyCom 10.1.1.10
I installed all of these
lm_sensors-2.10.7-4.el5.i386.rpm
net-snmp-libs-5.3.2.2-7.el5.i386.rpm
net-snmp-5.3.2.2-7.el5.i386.rpm
net-snmp-utils-5.3.2.2-7.el5.i386.rpm
4 of them are working fine, the application installed on 10.1.1.10 can query 4 servers but I got 2 Linux Centos that are in a DMZ, and my networking team already opened ports and configured NAT but the SNMP Server 10.1.1.10 is not able to query them how can I check the snmpd is really running apart from service snmpd status? might be related with the DMZ configuration?
I am the author of an internet radio for the Raspberry PI originally running on Debian Wheezy. The radio (radiod) service is started and stopped using the usual service commands:
service radiod start|stop|status
Since upgrading to Debian Jessie the service status and stop routines in my radio daemon are no longer called.
For example:
# service radiod status
● radiod.service - LSB: Raspberry PI Radio Daemon
Loaded: loaded (/etc/init.d/radiod)
Active: active (running) since Thu 2016-03-31 20:17:07 CEST; 15h ago
Process: 380 ExecStart=/etc/init.d/radiod start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/radiod.service
└─603 python /usr/share/radio/ada_radio.py start
If I call my program (which runs as a daemon) I see the status message from my program
# ./radiod.py status
radiod running pid 603
I have established that service stop never calls my program routines to shutdown the radiod daemon when the system is rebooted (I see that from my log files).
The reboot hangs for about 5 minutes whilst stopping the radiod service (because stop never calls my stop routines).
Below is my radiod script, which is fairly conventional, and which has been working all the time until I ported to Debian Jessie.
/etc/init.d/radiod
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: radiod
# Should-Start:
# Should-Stop:
[Code] ....
What is the proper way to make the smb and nmb services start (and keep running) automatically? I have successfully configured samba on my F15 box, but sometimes the other boxes cant see it. I check the status of smb and nmb and smb is running and active, but nmb status is "Running (exited)". If I manually restart nmb then nmb status changes to "Running (active)" and the problem goes away. However I want it to start (and keep running) automatically as it should. I am thinking maybe the problem is the way I set smb and nmb to start automatically.
I used
$chkconfig smb on
and
$chkconfig nmb on
Is this the correct way? if not, what is it? Maybe I need to be more specific about at which runlevels I want the services to start? I have googled, but found about 5 diferent methods to make this services start automatically, some with systemctrl, some editing files, chkconfig, and even the system-config-services app (which seems broken in f15 btw) and don't know which one to use.
I run a script manually like/usr/lib/openoffice.org/program/soffice and when I run
:ps -ef|grep openoffice
I get the following,
root 700 1 0 10:45 ? 00:00:00 /bin/sh /usr/lib/openoffice.org/program/soffice -calc
My question is how to check whether this script is running or not (It can be checked every 10 minutes) and how to make it as a service. (I don't have root access to put this in rc.local file or somewhere else).
I need a script that is able to check if a service is running or not. It has to do it automatic since it is for restarting a GameServer.
I tried to make one myself, but since the .x86 file has the same name for every server, it is hard to know a way to check if the server is running with the right process.
Is there a way to make a script which is able to check if a service is running (service has same name, but using other ports)
i've some trouble to write a script on java on linux to check if service(ie:smbd) is runing or not,, could you give me some example? Or if is there any source about it for me to learn? i've two days search with zero result...
View 5 Replies View RelatedIs there a unique command ( common to all Linux Distros, Solaris, Windows ) to know whether a service is installed and running on my system or not??
View 5 Replies View RelatedI need to make a SQL script and call it from Unix (bash) shell.
Code:
sqlplus vikas/vikas <<END
spool /oracle/vikas/output.txt
command 1
[code]....
This runs perfectly, but my problem is that if a command fails, the other commands keeps on running. I need to keep a check that when a command fails the script is exited. In unix we have an option of echo $? to check the status of previous command, But how to accomplish this SQL.
Im using PHP and Sun Solaris to do something for Squid Proxy Server. im using......
- LAMP / SAMP
- Linux / Solaris 10
- Squid Server
- PHP
actually i need to know that someone knows about how to start/stop Squid Service using PHP code.
I am trying to setup LDAP server on Ubuntu 10.04 and am sticking to the old /etc/ldap/slapd.conf file configuration.
I had to comment ldapi:/// from /etc/default/slapd since it was giving 'Address already in use error'. Also had to juggle with pid directory and file issues
After that I was able to start the slapd daemon (service slapd start) but now I am running into multiple issues:
1. Can't stop the service with service slapd stop
Code:
## Service stop returns 0, maybe because start-stop-daemon is not giving error
#service slapd stop
Stopping OpenLDAP: slapd.
# echo $?
0
Will switching to BDB database resolve this ?Also can't I slapcat at non-root user ??
A script looks as follow:
[code]...
# now we are at the end of all actions exit 0. When I type
[code]...
It should check if a Jboss instance is running. there is no Jboss instance running but it gives always out that "JBoss is still running - please stop the service first". Besides, I've checked with ps -fu $JBOSSUSER | grep -v grep | grep -v Agent | grep java | grep $CONTEXT and the output string is empty. Is there any error in my script?
I have a scenario where I am executing some child shell scripts in background (using &)through a master parent script.
Is there a way I can capture the exit status of each individual child script after the execution is completed.
I have startup scriptsI want to test themI need a script to do the followingstart restart stop for 100 times (or i can set how many cycle)
View 1 Replies View RelatedI'm having trouble trying to make a script. What I want to do is check if xScreenSaver is running in my user account. If not, run it. If it's running, kill it.
So this is the script I've made:
Code:
The problem is that I've echoed the output of $(pgrep -u $(whoami) xscreensaver) and it always seems to add 4 numbers to the pid, even if the pid doesn't exist. What do I mean by "doesn't exist"? That no xscreensaver is running in my user, and if I run pgrep -u $(whoami) xscreensaver in bash, I get not output, but if I run the command though the script, I get (for instance) 4050. If I run it again, I get 4054, and again 4058... etc. What the hell is going on with that?
I have an ubuntu 10.10 server and want to run a script on it to check if a process is running. If it is not running, it will start the process and also write into a log file.
When running the script i get the following error message:
syntax error near unexpected token `else'
Here is my script.
whats the difference between restarting/stopping apache using 'service httpd restart/stop' and apachectl restart/stop. I know that using 'service httpd restart' is actually a script in /etc/init.d/httpd but what about apachectl?
View 1 Replies View RelatedTitle : Author : Price
France : Mark : 40
Persia : John : 50
how i arranged my database. I am trying to write aprogram which does a search either using Title, Author or both.
[Code]....
but i am still unclear on how i am able to make the program check if either on of the input(either $Title or $Author) is not filled up, and if one of it is not filled up, use the other one which is filled to do a search.
I have written a small script from that iam appending the output to a file.If multiple users invoke the same script or if i invoke the same script n number of times (using &), the output file(ZZ/OUT) contains messup information.
++++++++++++++++++++++++++++++++
#!/bin/bash
#
[code]...
We are using one service Calypso but it is showing unknown status. I am using centos 5.0 Linux version and server client env. server and POS which is communucate with each other that is also stop working. after that service stop.
View 1 Replies View RelatedI am using CentOS 5.6 with Apache 2.2.17. The Apache was compiled from source using RPM build to comply with PCI requirements. Also Plesk 9.3 is used as a control panel, but other than the config files the Apache is pretty standard. When the httpd is started, there are no errors reported in /var/log/messages or in the error_log, and the httpd starts, shows up in ps and the pid file exists in /var/run/httpd.pid.
However when you check the status 'service httpd status' you get 'httpd dead but subsys locked'. You can add websites normally, and the proper config files are generated so I am pretty sure this isn't a control panel issue as I have other servers running the same control panel and Apache 2.2.16 compiled and installed the same way as the 2.2.17 and there are no problems.
I installed HP multifunction inkjet printer.Since then, I'm always noticing the blue HP HPLIP servicestatus icon in the system tray. It appears that I can onlyhide or quit it once it has started.Is there a way not even have it started from the system booting?
View 1 Replies View RelatedI have a script which basically does many tasks and most of them can run in parallel. The server it runs on has 4 cores, so I changed parts of it to a makefile, and then run them with "make -j 4" which helps a lot. But looking at "top" while it runs, I see it could be improved. Sometimes tasks wait for other servers, so a higher -j value would help. And sometimes multiple tasks are waiting on the same disk, then I think a lower -j value would be better.
The kernel is fairly good at sharing CPU time among the cores, but resources like memory and disks are not shared very well. As an experiment, I tried compiling the kernel with "make -j" with no number. It didn't go very well.
So I wondered if anybody know of a better tool for things like this. I think it should be possible to write something that could change the -j value while it runs.For example:
- Start as many tasks in the background as there are cores. When tasks finish, start another one until done.
- After a little while, check CPU and memory usage to decide if more tasks could run in parallel. Or maybe less?
- If different tasks iowait a lot, check if they wait on the same disk. If so, renice/ionice/suspend some of them. In these situations I think it's better to have them run one after another.
- Other ideas?
I thought of making a script like that, but I doubt I'm the first one with that problem. Also, there are probably lots of things I haven't thought of.
want to know what is the cmd to ping/check the link speed or something like Network Info. If for server checking (Show information CPI info) is (cat /proc/cpuinfo ) (correct me if im wrong)
View 4 Replies View RelatedWe have a Dell Poweredge 1750 server with 2 harddrives in RAID 1 running Debian Etch. Yesterday one of the hardrives stopped working but no error message appeared in syslog. The only indication was the amber LED diode. Is there a software way how to check that both disks are OK?
View 5 Replies View RelatedI'm running CentOS 5.5 and have created an init script. The start of the script contains:
# Source function library.
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
fi
The start bit works fine, but I'm having problems with the status and stop part:
status)
echo -n "Status of script: "
status "/bin/sh /path/to/script.sh"
RETVAL=$?
echo
;;
In PS AUX the command appears as "/bin/sh /path/to/script.sh" and I can see the PID. But when I run:
./my_init_script status
It says the script is not running. Should I be using the /bin/sh bit, or just the full script path, or just the script filename?
The stop part of the init script utilises "killproc". Again what command should I be using to successfully kill all occurrances of the script?
Ubuntu server, no GUI installed; two partitions: OS and user.How can I check the status of the user partition? E.g. Free space, directory, etc
View 2 Replies View Relateddd is wiping part of the hard drive( 270GB partition ) with /dev/urandom for quite some hours, is there anyway to check the proccess? like speed of the process etc., I read someone doing that with another drive while having access to other terminal because of the system, but since this is directly from the install dvd, I've no clue if there's anyway to do that or not. I'm asking that mainly because:
1) I prefer run things with some kind of verbose mode
2) I accentaly opened the dvd driver (yes I know, but I forgot the install dvd was inside of it), but I closed it right after it, no errors, but it may have stopped working and has just the _ clicking?
The desktop search has stopped working in Gnome.I get a message that says 'Search Service not running' with a button that says 'Start Search Service'.When I click the button nothing happens
View 1 Replies View RelatedI'm using Debian squeeze and for an assignement, i have create 2 virtual pdf cups printers. Both are working very well. To test the different administion command; i try to disable one of the printer and move his queue file to the second one. I'm able to do it easily.
Now, i wish to write a bash script that wil test the status of the printer. So that,if the printer is disable, it just execute the "move" script. Is there a way to know the status of a cups printer and use that information in a script?
For example, a command/function that can return "O" is the cups printer is enable and "1" if not.