General :: Script To Monitor Port For Active, Then Send Command?
Mar 28, 2010
I need a script that would continuously monitor one port and when it is active (not listening or waiting) execute a series of commands to standard output.I am familiar with netstat but am not good with scripting so
I want to send something through the serial port, for example
[code]...
the point here is send some numbers to a couple of 7 seg displays, so I will wire a RS232 chip on a protoboard, the logic after the RS232 is not an issue, but how can I assure the data is being sent right from my linux box to the RS232 chip, the one on the protoboard? Do I have to write a C program to read the strings and then send them to the serial port?For example if I wanted to send this to the displays:
[code]...
So I guess the simplest way is (Supposing I can deal with the stream so it is filtered and only display the number array) $ ifstat > /dev/ttyS0 But, how do I know if the RS232 will take them as the right characters?
I have a mail server i need it to send message via port 587 not port 25, i make some changes to my postfix server which i use and it is already successed making a telnet to 587 port like it :
" > logfile.txt : gives an error extra character after the "
2- logsave logfile.txt 'send "show command;
" ': error invalid command
3- i simply tried to send the output of the whole script to file logsave /home/logfile ./script : seems that logsave work under root only
4- ./script > logfile : the problem with this is that the output of echo or (read "enter your id") command will not be displayed on the screen (actually nothing will be displayed, i have to open the log file to see the output). is there any way to save the log of the "send" ? or to save the log of the complete script without hiding the output on the screen?
I'm fairly new to touch screens. I'm having a look on Amazon at multi touch monitors like an HP 2310ti and it seems everybody just accepts that Windows 7 can handle it out of the box.
How does it work? I can't find any resources explaining how the PC receives the input from the touch screen.
Do I need to connect the PC with the monitor via USB, or is there wireless/bluetooth technology embedded in the monitor like in a wireless keyboard/mouse? How does Linux handle such a monitor out of the box? Does it recognize something like 2 connected mouse devices? I read about a few projects trying to implement this stuff in Xorg/GTK, but it seems to be pretty experimental at current state (because there is little information, if any, on this topic).
I am trying to send data through a USB port to a printer which can recieve text file. Now to send the data to the printer I am doing echo "Hello World" > /dev/usb/lp0
but the data doesnt seem to be sent to the printer because I have an analyzer to monitor the data sent to the printer. Is there anything else which I need to do
When I typed netstat -lna, the output: Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:580 0.0.0.0:* LISTEN ... ...
Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node unix 2 [ ACC ] STREAM LISTENING 23581 ... ...
Can anyone explain to me: 1. What is "Active Internet connections" & "Active UNIX domain sockets"? 2. What is unix Proto? 3. Difference between LISTEN and LISTENING state.
I'm trying to solve an intermittant serial port problem on an embedded medical monitor. We have determined that the port is receiving characters from the external device but the serial thread is not transferring the chars from the buffer. Has anyone seen this before? Looking for some guidance on what to look for. this problem happens at start up about 1 in 50 boots. We're using kernal 2.6.29.6.
I have a minecraft server running as a daemon. When you run it normally (not as a daemon), you can type commands into the console. How can you get to the console so I can send it commands while it's running as a daemon?
We all know how to kill multi process but if we want to send different signals to different process like to stop,-9,to hungup simultaneously at the same time then how we will do it,is there any particular command to do it.
hope you will know the net send command of windows.in the same way we are working on linux red hat 5.0 we want to know the equivalent command of net send for linux if any body know then please tell us? we are here only when we not found on google so please do not give the suggestion of searching on google.
I'm currently writing a C++ application to manage some screen functions in Debian(server).
However this issue have bothered me for 2 days now...
What I want to do is to send a command to an attached screen which is running.
Used the following command: Code: screen -S screenwindow So I send a command with the -X parameter, which works just fine... Code: screen -S screenwindow -X stuff yes The command I want to send is "yes" and it does appear in my screen window when I attach it.
But the problem is that I need it to submit it... well I need to press "enter" and I've been looking everywhere on how to do that.
Because right now it hangs on a line like this: Code: Something here, do you want bla bla: yes Obviously I could just press enter myself, but the problem is that it's running as a deamon and but it is supposed to do this all by itself .
I open up 2 xterms on my desktop, A(/dev/pts/0) and B(/dev/pts/1).I can write from A to B using redirection e.g. echo "test" > /dev/pts/1How do I run a command from A on B? e.g. "clear"Basically I'm putting the 2 terminals side by side, and using terminal B to display the contents of the current working directory, by running the following in A:export PROMPT_COMMAND="ls -a > /dev/pts/1"but this fills up the screen pretty fast. I was actually looking for a way to clear up the second terminal.
I'm looking for an easy way to send basic emails for the command line. I have tried configuring sendmail and mailx, but I have yet been able to receive a test email at my remote address. I have read through a fair amount of "how to" on this but I am a little confused and obviously not doing something right. My sendmail.mc file is as follows
I'm trying to configure my Red Hat server to use port bonding for two interfaces going to a switch, and I followed this redhat guide [URL]...-redhat-server but when I attempt to bring the bond up, it simply uses mode 0 (round robin) instead of mode 1, which I specifically configured in /etc/modprobe.conf by doing
Code: options bond0 mode=1
Any ideas why the bond would continue to use round robin when I set it to active-backup?
I've got a Debian Squeeze computer on which the graphics have packed up, but the terminal in single user mode work perfectly fine.
There are a few files on this Debian computer that I want to transfer off, to a networked computer, but I have no idea how to do this.
The destination computer is a freshly re-setup Mandriva install, without (as yet) samba. I don't think it's necessary though. The Mandriva install works fine, has graphics, etc, but can't see the Debian Squeeze computer on the network, possibly because it's in single user mode, thus prompting the problem of how to transfer the files, using only a command line.
I am working on RHEL4 ES server. In our system Talk is not activated(i did not find it in services). To send a mail thru web based mail it is time taking process. I want to send a message(or a mail) to other server. How can I do this? Example: my server IP is 10.xx.xx.xx and the other is 10.xx.xx.xx
Send an E-mail to your local account. Try two different ways to send and read it. How can you check that it really arrived? I decided to try using the 'mail' and 'pine' commands. So:
1) Using the root account, intending to send an e-mail to myself (root):
Code:
# mail -s "Hello root!" root Simple form of sending e-mails internally. ^D (this keystroke is to finish the e-mail) EOT
2) Using 'pine', another e-mail client: The mail is composed correctly, with 'To:' field set to:
Quote:
[URL]
which is my hostname, as my box runs in a VMWare Slack 12.2 image. In both cases, nothing was received in my mailbox (by typing #mail)... Additionally I don't see any new e-mails when I look at the file '/var/spool/mail/root'. Do I need extra information configuring my mail client/server/service?
I have 2 computers with linux, How can i send with ftp files from computer1 to computer2 them(shell command)? Steps that i think should be done (miss shell commands): find inner ip of computer1 open the ftp port (21) of computer1 (make computer1 ftp server) send file from computer2 to computer1 with shell command
I've just setup a new Ubuntu 10.04 LTS server on linode for myself. Followed an excellent instruction at: here to finish the installation of some basic stuff including postfix.
I am trying to figure out a way to send an email to my gmail address with an attachment, but cannot find how. Already confirmed that email can reach my gmail account.
In the end I have to use mutt to send the email with attachments, probably SendEmails will also do well, but I am wondering how to do the same thing in postfix from command-line?
how to include my command results in a script? Basically what the script does is it checks the status of a service within the linux server, then sends an email when done. I want to include the results of my status check to my mail when sent.
i.e. service dhcp3-server status Status of DHCP server: dhcpd3 is running. <---this I want to include in the mail that is sent out via script.
I'm installing a server to act as a firewall between a local network and internet. I've installed Firestarter becaused it worked straitgh away (it seems that FS is configuring the routing as well). I've tried to remove it, and then I lost the access from LAN to Internet. (I don't know why -perhaps the routing is disabled then- , so I prefer to keep it).
The problem is that Webmin Bandwidth Monitor (bandwidthd) is not logging anything when FS is active. Does someone has an idea on how I could make it work? I've tried cacti and some other stuff, but it is far too complicated for me.