Programming :: Write DOS Script To Monitor The PC's Network Status?
Jan 15, 2010
There are a few PCs on the network that lose network connection every so often -- sometimes these old beasts have a power failure and owing to a bug in the BIOS the NIC doesn't necessarily initialize properly, which requires a reboot to correct it. Got me thinking of a band-aid -- have the PC ping a specific IP address, and if it cannot ping then it forces itself to reboot.
IF I were to write it in BASH I'd do it like this:
#!/bin/bash
HOST=<some meaningful hostname or IP address>
for ipaddy in $HOST
do
count=$(ping -c 1 $HOST | grep 'received' | awk '{print $4}')
if [ "$count" = "0" ]; then
sh usr/bin/reboot
fi
done
In English: send 1 ping to the IP address. Grep through the results to see how many of 1 ping was returned. IF it returns 0 pings then reboot. I'm sure the reboot command would have to be groomed a bit for sudoers but that's beside the point here.
So, HOW do we write something like this for DOS? Stop giggling (lol). No really, I have Windows 2000 & XP machines that need some sort of script or method of knowing (at intervals) of when they're not talking to the Host system, and need to reboot to fix it. I was thinking to write a simple test script, drop it on each of these machines and use the Windows task scheduler to run it every 30 minutes.
View 3 Replies
ADVERTISEMENT
Dec 25, 2010
In my tmp directory some logs are creating continue (with name logs.txt1, logs.txt2 up to 245). Some times these logs are creating continue within 1 or 3 second gap, now I want to write a bash script that continue monitor the tmp directory and if any time logs create simultaneously within 1 or 3 section gap it will alert me..( generally logs are create with the gap of 5 or 10 minutes duration or some time after one hours )
View 1 Replies
View Related
Jan 13, 2010
I need to monitor my filesystems and get an email when the status is warning >=80 and critical >=90. I am not very good for scripting so I found an script but is not working for me This Red Hat Enterprise 5.0
Script
Code:
ADMIN="me@somewher.com"
# set alert level 90% is default
ALERT=90
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
[Code]....
View 11 Replies
View Related
Jun 8, 2011
during an "apt-get install" the filesystem of a virtual machine filled up and so it failed. I have now increased the file-system size but running the same "apt-get install" again results in this error: "E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem." However when I try to run 'sudo dpkg --configure -a' I get this error: "dpkg: failed to write status database record about 'libxmuu1' to '/var/lob/dpkg/status': No space left on device" How can I recover from this situation?
View 1 Replies
View Related
Mar 31, 2010
I want to write a script that would monitor a folder. Everytime a file is dumped in that folder the script would send it to the proper location.
Example
123.mp3 --> music
something.avi --> movies
and so on , now is there a way to that without running a script in cron or running a loop that activates every 5 seconds or so ??
View 3 Replies
View Related
Jul 22, 2009
Im just trying to write some script to caputre memory and cpu usage on SLES servers, I just wanna use "top |grep Mem" and "top |grep Cpu". when I ran the above command, it just keep going. i just want to get one line each for memory and cpu.
View 3 Replies
View Related
May 25, 2010
How can I programatically know the status of a process if its PID is known?
View 1 Replies
View Related
May 20, 2009
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 Related
Jan 7, 2009
I'm trying to compile a c++ application in KDevelop in Ubuntu 8.10. I get this error on Distclean:
aclocal
autoheader
automake
[code]....
View 19 Replies
View Related
Jul 28, 2011
How to write a cron jobs in linux to monitor my project diskspace usage?
check diskspce= du -h .
any clue for me as a beginner?
View 7 Replies
View Related
Jun 10, 2010
I am running a command pretty similar to the one below:
Code:
I need to capture the exit status of that part of the command.
What I am trying to do is set a variable that can be modified within my_job.sh, and used to exit.
However, no matter what I set "status" to in my_job.sh, it exits with "0".
What can I do differently?
View 3 Replies
View Related
Mar 3, 2010
How exactly can I use the exit status of a command in an if statement ?
Something like this:
Code:
View 3 Replies
View Related
Aug 7, 2009
I 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.
View 2 Replies
View Related
Dec 19, 2009
I just installed a fresh copy of 11.2 I use networkmanager and the cisco vpn plugin (not the cisco client). I create a vpn profile and connect to it. The icon shows a connection has been established, but I have no network connectivity. In the /var/log/NetworkManager file, I see this
Code:
Dec 19 13:28:08 TonyLaptop nm-dispatcher.action: Script '/etc/NetworkManager/dispatcher.d/netcontrol_services' exited with error status 127.
When I sudo vpnc and connect that way, it works fine, it connects and I can pass traffic.
I am using opensuse 11.2x86
firewall is disabled
Gnome
View 3 Replies
View Related
Nov 13, 2010
Code:
rcapache2 server-status
HTTP 400: Bad Request
Code:
w3m -dump -cols 80 https://localhost/server-status
HTTP 404: Not Found
View 9 Replies
View Related
Jun 15, 2010
what is the command for checking the network performance and status?
View 3 Replies
View Related
May 24, 2011
I have and embedded system which apparently, due to space considerations, is missing lots of normal commands. I can get the following information by "cat /proc/version":
Linux version 2.4.19-uc0 (...) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(-msep-data patches)) #461 Tue May 24 12:06:06 PDT 2011
At issue is the fact that, after some time, the system stops responding to the Network (e.g., you can ping it, then some time later you can't). We suspect that some sort of network monitor is accessing the device and causing the trouble, but don't know for sure.
What I would like to do is log some sort of useful network status information and/or be able to reset the network if I can figure out there is an issue from within the device.
I thought I had it all working using "/etc/init.d/network restart" but I've come to find out that the command is not recognised in this system. I also can't issue a "top" command to see what services are running. I can Telnet in, so I can try commands and see if they work.
Have any of you worked with such an abbr. system and if so, what might be around that I'm unaware of to help determine network status?
View 3 Replies
View Related
Jan 17, 2010
Actually I suppose to use this "htop" command to get the system utilities like current processor speed ,running programs ,memory usage(ram and swap) to my program. I planned to get it using popen(). I was success popen("top | grep Mem", "r") with top command. But are there a way to take such information using "htop". Or are there any idea of taking current CPU,MEM,Swp usage as well as Tasks and running tasks using htop or other way to C program...
View 1 Replies
View Related
Apr 8, 2011
I want to make an application that will update my facebook status. How can I make that ?
View 7 Replies
View Related
Mar 22, 2011
I am going to create a parent process and fork a child process from it. I want to write a code in such a way that whenever my child process end it must indicate that the child process is terminated by a signal or not. This code must be written in the parent process block.
View 6 Replies
View Related
May 27, 2009
I am new to scripting and been working on this bash script for awhile now. I been researching this problem, but I can't seem to find a solution. I was wondering if someone could please help me out. Here is my script:
#!/bin/bash
NO="ps -ef | grep NO | grep -v grep"
NOWC=`ps -ef | grep NO | grep -v grep | wc -l`
[code].....
I cannot get this script to run the "ps -ef" command on the client. It get its value from the host machine that I am running this script from. I need this command to execute on the client. When I run the command (ps -ef | grep NO | grep -v grep) on the client, I get something back. Here is what I get when I try to debug the script.
XX# ./test_ps5.sh XXXXX
+ NO='ps -ef | grep NO | grep -v grep'
++ ps -ef
[code]....
View 5 Replies
View Related
Apr 22, 2010
I get connected to the internet via a router. The router dials to my provider and is connected to my computers via LAN and WLAN (mostly WLAN, see below). A few days ago I installed Suse11.2 to an old laptop (connected both ways: ethernet with wire and wireless ethernet).
The access to the online repositories worked only after I added the LAN-Adapter (Eth0) to the Demilitarised Zone of the firewall (I did also with the WLAN Adapter).
1. Is this normal?
2. Should I add the network devices now to an other zone?
I want to update my main laptop now from openSuse11.1 to 11.2 via new installation (from DVD) and make this installation right.
Or should I install only the data on the DVD and update after the installation via Yast?
(My main laptop has also an loose contact at the ethernet adapter.)
Greetings pistazienfresser
Now I am using (on my main laptop = Samsung X20) openSuse 11.1 and Gnome 2.24.1 (mostly, 1 account is using KDE) and Kernel Linux 2.6.27.45-01.1-pae. "/home" is on an separated partition (as part of an extended partition). I have also 2 NTFS partitions for Windows XP (System and Data), and a FAT, a root (/) and a swarp partition. My router is a AVM fritzbox 7270 (firewall should be included).
View 6 Replies
View Related
Mar 10, 2011
After installing 11.4, I need to type in the command to update the firmware for a broadcom wifi adapter. Then I needed to reboot, twice, before the system knew to use the adapter (where the adapter wifi light goes from orange to blue).
Then I needed to add my wireless network and type in my key. But the key does not take. If I click on my wireless network icon, it just re-asks for the key and does not connect nor give any other message. Network icon continues to display no connection.
So I need to reboot again.
When the system starts again, the adapter is blue, I click on the icon for my wifi network and it connects without asking for my key and I can then set to start my wifi by default.
Now my wifi works fine.
View 1 Replies
View Related
Jul 5, 2010
I have just upgraded to Lucid on Ubuntu. I am a long time Pidgin user. I tried using Empathy with Gwibber, but I can't get Gwibber to update my IM status(es) in Empathy, so I want to go back to using Pidgin. (Additionally, I can't get Skype to work with Empathy.)I installed pidgin-microblog and pidgin-mbpurple, and they allow me to view my Twitter feed in Pidgin and update my Twitter status in Pidgin. However, in Karmic, I was also able to specify certain "status availabilities" (one named "Twitter-Available" and one named "Twitter-Away", for instance) to have the IM status message for these statuses become populated with my Twitter feed. This capability seems missing in pidgin-mbpurple in Lucid (and it seems to be the only thing missing from Karmic).
Is there a way to have pidgin-mbpurple update certain "status availabilities" in Lucid (and I'm just missing something) or is this no longer possible?Equivalently, is it possible to have Gwibber update my status message in Empathy? (I just want to be able to update my status once on one of my three computers - and have it propagate to all my other accounts (IM and social networking) and computers).
View 1 Replies
View Related
Apr 10, 2010
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.
View 7 Replies
View Related
Sep 6, 2010
how to make a script that will check service/s status whether running or stop and also will run stop services?
View 9 Replies
View Related
Mar 9, 2011
I am having a terrible time getting any networking to work with a new RedHat Enterprise 6 64 bit install. I am installing on an HP Proliant DL380G7.I have downloaded the driver - hp-netxtreme2-6.2.23-2.src.rpm from the HP website.Followed directions and did the following:1.Build Environment Setup - installed redhat-rpm-config and kernel-devel2.Installed the source (hp-netxtreme) rpm.3. Build the Binary RPM - installed rpm-build and ran the following:rpmbuild -bb /root/rpmbuild/SPECS/hp-netxtreme2.specIt runs through the build process and near the end I get the following:make -C /lib/modules/2.6.3271.el6.x86_64/build UBDIRS=/root/rpmbuild/BUILD/hpnetxtreme26.2.23/obj/default/bnx2-2.0.23b/src modulesexpr: syntax erromake[2]: Entering directory '/usr/src/kernels/2.6.32-71.el6.x86_64'/usr/src/kernels/2.6.32-1.el6.x86_64/arch/x86/makefile:81: stack protector enabled but no compiler supportmake[2]: gcc: command not found
make [3]: ***[/root/rpmbuild/BUILD/hp-netxtreme2-6.2.23/obj/default/bnx2-2.0.23b/src/bnx2.o] Error 127make[2]: ***[_module_/root/rpmbuild/BUILD/hp-netxtreme2-6.2.23/obj/default/bnx2-2.0.23b/src] Error 2make[2]: Leaving directory '/usr/src/kernels/2.6.32-71.el6.x86_64'
[code].....
View 2 Replies
View Related
Sep 25, 2010
I try to fetch links from a URL using HTML::LinkExtor, but it always return 0 links even if the status code is 200 OK. I am running the following code in Ubuntu 9.04, just curious if the module is too old and its ways of HTTP request is disabled by some platforms.
Code:
#!/usr/bin/perl
use HTML::LinkExtor;
[code]...
View 2 Replies
View Related
Feb 24, 2011
I tried changing the source to a few different ones and I picked "Select Best Server". Still getting the same msg. I am on a wired connection and there is nothing wrong with my connection.Anyone know the solution if not how do I install nvida drivers?
View 1 Replies
View Related
Mar 16, 2011
After a fresh installation of Ubuntu 10.10 I uninstalled empathy (im using skype). The empathy menu in the evolution indicator was gone after that.I also uninstalled gwibber. But the gwibber status indicator remains within the about-me panel... Uninstalling the gwibber package also removes the me-menu which I want to keep actually. Especially the shutdown/restart... part of it. See attachment.I know there is a shutdown panel-app...but its butt-ugly and it doesnt allow to logon/off.
In another thread I read that the gwibber status shouldnt be there if no account for it is configured... which it is not... I do use ubuntu-one though which is in the same menu... I saw that this issue was addressed at some bug report before, but not fixed yet...
Does anybody know a good workaround to get rid of the gwibber status in the panel while keeping the about me and the shutdown button?
View 3 Replies
View Related