Red Hat / Fedora :: Bash Script To Monitor Server Load / Mail From Command Line

May 4, 2010

I am attempting to write a very basic script that monitors a server's load and automatically emails an administrator upon the load reaching a certain threshold...

1.) `uptime | awk -F ' ' {'print $10'} | cut -d ',' -f1 | awk -F '.' {'print $1'}` -- the output from this command results in a decimal figure, so when that value is parsed and placed in an if statement, the value is not seen as a number. load-monitor.sh: line 9: [: 4.96: integer expression expected/How can I allow a number like "4.56" to be seen as an actual number within the if statement and be compared to 4, for instance?

2.) I am running a cPanel server on CentOS 5.4 -- when I run mail -s "SUBJECT" $EMAILADDRESS the command just hangs, and stracing the process shows it stuck on a read syscall.

3.) If I wanted to write this script in PHP, I have one primary confusion -- how can I mimic the functionality of obtaining the output from uptime via awk, etc. so that I can determine what the server load is at a given time? Which PHP function(s) would assist in that regard?

View 5 Replies


ADVERTISEMENT

Server :: Configure Mail With Postfix & Cyrus-imap - Cannot Send Mail Through Command Line

Nov 19, 2010

I'm running SUSE linux Server version 11. I want to configure mail server with postfix & cyrus-imap. For that, i have read many documents in Internet by i met issues. I'm running DNS in this server & it's ok Now I cannont send mail through command line.

[Code]....

View 9 Replies View Related

Server :: Send An E-mail With The Command Line?

Sep 12, 2010

I want to send a simple mail from my terminal

I'm using opensuse and a Know that I have postfix installed...

I don't know what I need configure first...

I know that I need a SMTP server to send e-mails write?

When I try send e-mail with the command mail I received this message :

Code:
mail -s "meeting reminder" -c professorgenival@hotmail.com micromerces@gmail.com
mailq:
Code:
(host mx4.hotmail.com [65.55.92.168] refuse to talk to me: 421 cannot conect to SMTP server.

I was reading about fetchmail But I can't understand....

View 4 Replies View Related

Ubuntu :: Command Line Mail Client Server?

Jan 27, 2011

I have just got myself up and running on a ubuntu 32 bit server with postfix using this guide here [URL]...at-ispconfig-3 and everything is working great ( i didnt install ispconfig )

I want to get a command line mail client running but I am having some permission issue.

sudo aptitude install heirloom-mailx
then when i type mail this happens
mail
/var/mail/jj: Permission denied

i also tried mutt etc but always get permission denied.

View 6 Replies View Related

Networking :: Send E-mail From Command Line By Using "mail" In Fedora?

Jul 13, 2010

I am trying to send e-mail from command line by using "mail" in fedora. It goes to e-mail server in the same network but it is refused by other outside this network with message: "..... Connection refused by name@yahoo.com ......

View 1 Replies View Related

Fedora Servers :: Pptp - GUI - Command Line To Manage Users - Monitor?

Nov 26, 2010

I am going to build a Linux VPN server(PPTP) for my friend but here is the problem: He don't know Linux and command line to manage users, monitor server, etc

View 1 Replies View Related

Ubuntu Servers :: Bash In 10.04 Server - Every Empty Line In The Script Results In "command Not Found"

Oct 8, 2010

Bash acts weird in 10.04 server. Whenever I try to run .sh scripts, every empty line in the script results in "command not found". Then on even simple scripts I get syntax errors, but the same exact scripts work on my 9.10 desktop installation. There's also another problem, I'm not really sure if it's bash-related. After setting the proxy using

[Code]...

View 5 Replies View Related

Debian :: Bash / Mail / Command Not Found

Dec 27, 2008

I did install a brand new debian etch on my server, update and upgrade has been done.I did installed a postfix and couple of tools ( like courier-* ).But when i want to try to sent a mail with mail command, it says command not found.I did use the method on the bottom of this thread succesfully, but any idea for this tool to be back on my server ?Did i uninstall it when installing a package ?

View 1 Replies View Related

Ubuntu :: Sending Mail From Command-line?

Jan 5, 2010

I have kubuntu 9.10 and I would like to configure Ubuntu to can send mail from command line with mailx. I've saw that I need to install a MTA. But I don't know wich install and how.

I follow this tutorial:

[URL]

But when I try to send a message, in the mail.log says me:

Code:
Jan 5 10:21:33 david postfix/smtp[3795]: 41AEA41DBE: to=<pepelu@gmail.com>, relay=alt1.gmail-smtp-in.l.google.com[209.85.223.73]:25, delay=1086, d
elays=1022/0.01/32/32, dsn=4.7.0, status=deferred (host alt1.gmail-

[Code].....

View 3 Replies View Related

Server :: Send Mail From Unix Mail Command To Yahoo-id With Attachment?

Feb 15, 2010

i want to send mail from unix mail command to my yahoo-id with attachment, but i want to receive it as attachment.

View 1 Replies View Related

Debian :: Any Program To Send Mail From Command Line?

Sep 9, 2010

Is there an easy to use program that I can use to send mail from the command line? I want to be able to create a batch script to send mail from different text files. What I'm looking for is something like:
mailapp mailserveraddress destinationmailaddress mymailaddress filetosend

View 11 Replies View Related

Ubuntu :: Mail() Works In Command Line But Does Not In Browser?

Jun 18, 2011

I'm trying to configure sending mail from my site under Ubuntu 10.04 LTS.I have installed LAMP and postfix. To test mail I created the file test.php with code:

PHP Code:
$to = 'mymail@gmail.com';
$subject = 'The subject';

[code]....

View 1 Replies View Related

General :: Delete Mail Root In Command Line

Jul 1, 2010

I want to delete all may mail root in command line and i don't find this... the command mail + "d" work fine but i want use it in a .sh

I explain too : I use fetchmail to have mail from a gmail box, and use RIPMIME to save the attachment in a folder... these work fine, but the i want delete these mails.

View 3 Replies View Related

General :: Failing To Send Mail From Command Line?

Mar 16, 2010

I am using Ubuntu 9.10 and when I tried to send mail from the command line I get: /usr/lib/sendmail: Permission denied. any takers on this.

View 6 Replies View Related

CentOS 5 :: Setup Mail Client From Command Line?

Aug 9, 2010

I have installed CentOS 5.5 with no GUI - how do I enable/setup the "mail" client command to be able to send email via my Exchange 2007 mail server on my LAN?

View 1 Replies View Related

Ubuntu :: Load Terminal From Command Line?

Jan 17, 2011

I was tinkering around with my /etc/grub.d/10_linux file to try and alter the way my OS's were displayed on startup and somehow I filtered out my Ubuntu option, now I have no way off accessing the terminal, I tried the command gnome-terminal, but had no success, does anybody know how to access my /etc/grub.d/10_linux file through the grub2 command line?

View 6 Replies View Related

Software :: Monitor The CPU Temperature Via The Command Line?

Jun 20, 2011

I am running CentOS on this box and I'd like to be able to monitor the CPU temperature via the command line. Is this possible?

View 2 Replies View Related

Fedora :: Run Python3 Scripts From Command Line And Call Up Python 2.6.2 Idle With The Command Idle From Command Line?

May 29, 2010

i've gotten my fedora 12 to the point where i can run python3 scripts from command line and can call up python 2.6.2 idle with the command 'idle' from command line. what command will call up python3 (3.1.2 to be exact) idle?

View 5 Replies View Related

Debian Configuration :: Can't Send Email From Command Line Using Mail

Mar 17, 2010

I'm running a desktop-less version of Debian via Sun VirtualBox. The reason I'm doing this is because I don't have enough graphics or RAM power to have a desktop environment running on top of my current desktop; also, I want to learn Linux through the command prompt. I'm running the AMD64 version of Debian; I'm not sure if that's relevant.

My main goal is to be able to email useful files from the virtual Debian to my main computer, so that I can save them for later if I ever decide to do a "real" installation of Debian on this computer. I realize now that there's probably some "easy" way to do this by reading the virtual machine's hard drive, but at this point, my curiosity wants to see this issue resolved. I started off wanting to find a command-line program to send my email with, and one was built-in. The syntax ~$ sudo mail -s "Subject" email@yahoo.com "This is a test email."

C^D
Cc:C^D ~$

is what I found. I tried it, and (unsurprisingly), it failed. I then learned that the mail command calls exim4, or something along those lines, so I needed to configure exim4. Soon thereafter, I learned that Yahoo's SMTP wasn't public, but Google's was. So, I found this web page which described how to configure exim4 to allow for email to be sent to a Gmail account. I made one, and followed the page word-for-word.

I sudo-mailled a test email to my Gmail account, and nothing happened. I waited a bit longer, and still, nothing happened. Finally, I started looking around, and found out about the exim4 logs in /var/log/exim4. In my mainlog, I think that it's telling me that Google denied my connection: <date><time><random numbers and letters> == **********.gmail.com R=send_via_gmail t=gmail_smtp defer (111): Connection refused

So, now, I'm just stuck. I don't know what I did wrong, I checked my exim4.conf.template twice for spelling errors, but I don't think I made any. At this point, I can only hope that someone else has had a similar problem, or knows what I'm doing wrong (or haven't done yet).

View 14 Replies View Related

General :: Send Gpg Encrypted Mail Automatically From The Command Line?

Sep 14, 2010

How can I send gpg encrypted mail automatically from the linux command line?

I'm a little stumped on this one, I've tried using mutt but it doesn't encrypt mail unless it's used interactively.

Does anyone know if you can use the build in mail command to do this some how?

View 1 Replies View Related

General :: Command Line Sending Of Mail Attachments ( DB Backups)?

Dec 17, 2010

I'm am not remotely familiar with the linux operating sytem and just need a simple 'cut and paste solution' that will allow me to send .gz files as mail attachments, from the command line.Recently I moved my website to new hosting company, they are using cpanel and I have set up a couple of commands; the cpanel scheduler runs them for me as required.

1.creates an mysql dump and saves it to folder ( in root of my space )Works fine.2. delete the file created above, after 15 mins. Also works fineWhat I really want to do is email the .gz to myself before it is deleted, this is were I am stuck.This is possible ( I believe ) but it is beyond my understanding and ability to write the scipt/command that will make this happen.Please make any instructions really simple and clear as I am really new to this.on the server and this information is provided below and may be helpful to you (but I certainly to not know anything about this type of stuff)

View 7 Replies View Related

General :: Empty Bash Command Line?

Sep 28, 2010

I am looking for a way to delete the currently entered commandline without wasting seconds on the "Backspace"-key.

For example I scrolled the bash history and have a long commandline that would execute when I pressed ENTER:

~$ aptitude search openssl | grep dev

But now I decide that I do not want to execute this command. Can I get an empty prompt fast without deleting the whole line with Backspace? On the Windows "cmd" you can just press ESCAPE and it is gone. This behavior would be what I want.

The question may seem trivial but this is bothering me for a long time now.

View 2 Replies View Related

Ubuntu :: Dim Monitor Backlight Through Software/command Line

Sep 3, 2010

I am doing a project that involves dimming monitor backlight and Im in the process of searching a PC to be used for the project.

I ran ubuntu live cd in a PC shop to see if I can use the ff command: echo 30 > /proc/acpi/video/xxx/xxx/brightness

However, all brightness files just contain <not supported>. Is there another way to adjust the brightness (not using buttons)?

Since the monitor is dimming when idle (through built in power management), is it safe to assume that there is a way to do this?

I already need to confirm if we would order the PC. PC is Asus ET1610PT (all-in-one PC, touchscreen monitor)

View 1 Replies View Related

Fedora Installation :: Install A Command Line Server Without Gui?

Mar 22, 2011

I need to install a command line server without gui and smallest as possible Is there a option on installer to obtain a minimal server?

View 4 Replies View Related

General :: Load A GTK 2.x Theme With Command Line / Shell Script?

Jul 18, 2010

I would like to know how i can load a gtk theme with a terminal command line or with a shell script if possible.

View 14 Replies View Related

Programming :: Echoing A Command Line Within A Bash Script?

Jul 8, 2011

Bash 3.1.7

Suppose this bash script:

Code:
#!/bin/bash
ls foo

I would like the output to be

Code:
ls foo
foo

That is, the command is first echoed then executed. Is it possible to do this? Or is the only way to debug the script?

View 2 Replies View Related

Red Hat / Fedora :: Install GCC To Compile Java On The Server Using Command Line

Feb 21, 2011

I'm using a webhosting server running CentOS, and I'm trying to install GCC to compile Java on the server. Since I'm new to Linux and don't have root privileges, I'm having trouble installing this. I need to install this using command-line. I don't know if I should compile from source (which I downloaded off the "gcc.gnu.org" website) or if I need to install a binary or something. Can I even install anything without root privileges?

View 9 Replies View Related

Programming :: BASH - Works On The Command Line, Hangs As A Script?

Jul 16, 2010

I'm writing a Bash script to take IPTC keywords from a text file and write them, via Exiv2, to several (first batch is 100) JPEG files in a single directory. The script has one while loop inside another while loop, both terminated, but I'm pretty sure that's not my problem. I think it's how I'm incrementing the "counter" variable, although it could also be the method of parsing the text lines from the file (using cut with delimiters that have worked fine in simpler scripts).

Here's the code as I've worked it up to this point.

Code:

And yes, "keywords" checks out in Crimson Editor, Emacs GUI and nano as an ASCII file with UNIX line endings. No issues on that score.

Feeding each line consecutively into a terminal (excepting the exiv2 command) works fine: each variable echoes with the part of the text line used as a variable value as it should, even when the b variable is incremented the quick&dirty way (up arrow three commands and hit enter).

Running the above script in eval mode (sh -x) stalls after setting the b variable to one and reading in the first line of text. I'd like to know why. I'd also like some advice on another reliable method of parsing the read-in lines.

View 14 Replies View Related

Ubuntu :: Command Line Mail Taking Too Long To Send; Unable To Qualify Own Domain Name?

Feb 5, 2010

I'm having a problem with my mail. When I send mail, it takes a long time for the send to complete.In the below, datestamp is just a simple script to put in a no-white-space date/time stamp.

Code:
$ datestamp ; mail woodnt; datestamp
02-05-10@193844

[code]....

View 9 Replies View Related

General :: Bash : Pass Command Line Arguments Containing Special Characters?

Jul 14, 2010

I've written myself a linux program "program" that does something with a regular expression. I want to call the program in the bash shell and pass that regular expression as a command line argument to the program(there are also other command line arguments). A typical regular expression looks like "[abc]_[x|y]".Unfortunately the characters [, ], and | are special characters in bash. Thus, calling "program [abc]_[x|y] anotheragument" doesn't work. Is there a way to pass the expression by using some sort of escape characters or quotation marks etc.?

(Calling program "[abc]_[x|y] anotheragument" isn't working either, because it interprets the two arguments as one.)

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved