Programming :: Stopping Alarm() From Terminating The Process?
Jan 15, 2010
I am working in Linux and have connected a normal LED to my serial port (with voltage conversion). I am just trying to make that LED blink periodically using alarm ().So in the signal handling routine of my code,i toggle the LED but then the program quits as SIGALRM terminates the process. Shall i make a nested alarm so that the handling routine also has an alram()? I am stuck and i must confess that i am not so convenient with signal handling so can someone provide some pointers?I thought about using sleep(); but the advantage with alarm is that it waits for the exact number of seconds (when the second turn over from previous to new value) before raising the alarm while i am not sure about sleep taht does that or not.
View 2 Replies
ADVERTISEMENT
Oct 18, 2010
how to start a process in Ubuntu terminal window that is not killed when the terminal window closes.
View 9 Replies
View Related
Jun 30, 2011
Is there any program to terminate process automatically if using more than 90% or 100% CPU time for more than 5 seconds? I have a program that opens a web browser, do some stuff on it and close it. But problem is that sometimes that browser starts using 100% CPU
View 2 Replies
View Related
Jan 29, 2010
I am using Fedora12 with latest update, and am using kde4.3.4.
To decrease the memory consumption on one of my system I disabled many services presently only following services are running:
NetworkManager
abrtd
acpid
akmods
[Code]....
Now I want to stop some default running process like modem-manager, seapplet, ksmserver, krunner and sometime knotify4. I could not locate the initiation point of these services. So that I can manage (start/stop) these services.
View 5 Replies
View Related
Jul 15, 2010
Possibly related to this previous question, I would like to be able to run a task for a specified amount of time, then stop/kill it, then start it again. Specifically, I run the Folding@Home application on my Linux workstation. Periodically, it will have trouble logging-in to the home server, and will sit idle for a long time, but not release memory/resources it has claimed (yes, I realize this is likely a bug in the tool, but I can't fix that currently). Typically just the act of killing and starting the tool will allow it to check-in again. So, I would like to be able to run something like:
run_for <time> ./fah6
Does such a tool exist, or should I write a wrapper than nukes the fah6 client after, say, a week and restart it?
View 4 Replies
View Related
Jan 12, 2011
I am not positive that this is the right subforum for this post. It is technically a programming question but I am not sure if this is the best place for bash scripting questions. Anyhow, I have been having trouble getting up in the morning. I am a pretty good morning person and once I am up, I am good to go. The problem is getting out of bed. Traditional alarms have just not cut it in the past; there is always an easy way to shut them off and go back to sleep.
Recentliesh, I decided to try to make an alarm script in bash that would be more successful in getting my lazy behind out of bed. I am a newbie bash scripter at best so my attempts have been very simple but have not cut it so far. Here are some examples:
[Code]....
The above script was the version of my bash alarm. It will not stop ringing until I input that ridiculous phrase. The big issue with this script was that I would input the phrase quickly and go back to sleep. It was however, much more successful than traditional alarm clocks. Another obvious pitfall was that even though control-c'ing the process would not work, the terminal could be closed and that would be the end of it. I'll get back to that issue. Here is my second attempt:
[Code]....
View 7 Replies
View Related
Jan 28, 2011
I'm using asctime function to print the time to a file, however it always puts a new line with it, for example if I do
fprintf(pFile,"%s",asctime ( tm ));
fprintf(pFile,"hello world");
it writes
Fri Jan 28 18:11:38 2011
hello world
rather than
Fri Jan 28 18:11:38 2011 hello world
it's as if asctime adds to the end.
View 3 Replies
View Related
Apr 6, 2010
I'm trying to create a script that will trawl through a directory structure looking for VOB files, convert them to AVI and place them in a ./converted/ sub-directory of the the original source folder. I've knocked up the script below which appears to work fine when I place an "echo" in front of the actual ffmpeg encode line, I get the output on the screen with ffmpeg finding all the VOB files in the directories and looking to convert them to the correct sub-directory. Yet, when I remove the echo and run the script for real, ffmpeg converts the first file and then stops. No errors. Is this something to do with ffmpeg or a problem with my script below?
Code:
#!/bin/bash
#
[code]...
View 6 Replies
View Related
Nov 9, 2010
I have a shell script to identify whether the process is running or not. If the process is not running, then I execute another script file to run my application. Below is my script and saved this script as monitorprocess.sh Code: #!/bin/bash
result=$(ps -ef | grep -v grep | grep "applicationname.sh" | awk '{print $2}')
echo $result
if [ "$result" == "" ];
[code]...
View 4 Replies
View Related
Mar 31, 2011
Is there any difference in cpu usage for process in init.rc(runs automatic when boot is happened) and manually running process. Will these both have same priority by default...?
View 1 Replies
View Related
Nov 26, 2008
I tried googling but didn't get any answer for this.I have a process called "abc" and it is running with PID "123".I have a putty session opened with PID "999".I am giving kill -TERM 123 from putty session.My process "abc" before dying it should catch the PID of the terminal which provided TERM signal to it.Is there any way to find this out
View 2 Replies
View Related
May 16, 2011
Boot of a new minimal system hangs on "Stopping save kernel messages" or "stopping system v runlevel compatibility". I have ubuntu minimal iso x86_64 from usb stick created with unetbootin (don't have a cd drive on the machine in question), and after that I didsudo aptitude install gnome-terminal network-manager-gnome gdm geditsudo rebootnever got a system back. Annoyingly I can't boot into the recovery mode either, and it seems the keyboard is only semi-responsive (i.e. many dead keys when at the grub menu).qualms about reinstalling, but I've done this a few times and ended up at the same place every time.
View 6 Replies
View Related
Feb 21, 2010
I'm trying to make an "alarm clock" with mpd and gxmessage. Gxmessage allows you to assign unique exit codes for its buttons to use in your script. This is what I have so far:
Code:
#!/bin/bash
vol=$1
mpc clear
mpc load alarm
[Code].....
Now I know I'm way off with the case statement, because when the alarm_message function is called within the case, both of the exit codes I assigned to the buttons (-buttons "Stop":1,"Sleep":2 ) return to their default value.
What I would like is for every time the "Sleep" button is pressed, it would pause mpc, sleep for an amount of time, play, then open gxmessage again to restart the case statement (retaining the exit codes I assigned to the buttons). Am I on the right track?
View 2 Replies
View Related
Jan 23, 2011
In December I finally filled up my root partition and broke Suse 11.1. I therefore resized my partitions and installed Suse 11.3 on /root. I didn't not touch my /home partition.
I notice that when I leave my machine and come back the screen has locked. I have tried to turn off the screensaver, but it hasn't worked. I have Googled, but unfortunately the screen shots don't look like what I have and the instructions to stop this do not seem to match what I am seeing on the screen.
Is there a way to do this via the command line?
View 7 Replies
View Related
Nov 9, 2010
I have a shell script to identify whether the process is running or not. If the process is not running, then I execute another script file to run my application. Below is my script and saved this script as monitorprocess.sh
Code:
#!/bin/bash
result=$(ps -ef | grep -v grep | grep "applicationname.sh" | awk '{print $2}')
[code]...
View 14 Replies
View Related
Mar 10, 2011
I want to kill parent process after "fork()" method. but if I kill parent process with "exit(0)" method, main() thread is terminated as well so child prosess doesn't work anymore. Is there any way to kill only parent process without affecting to child process?
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
[code]....
View 1 Replies
View Related
Jul 18, 2010
I am running webmin on ubuntu server 10.04lts I have dovecot installed.when I try to check for mail the server unexpectedly terminates the connection. window live mail gives this error, and when i use telnet to try to login and get email it terminates the connection right after i send the "PASS thisismypassword" command.
View 8 Replies
View Related
Dec 7, 2009
Consider the following code:
Code:
int main()
{
int i=0;
pid_t pid;
for(i=0;i<2;i++)
[code]....
I get the following output:
Parent: chid_pid=4356 i=0 parent's pid=4355
This is child 4356 i=0
This is child 4357 i=1
[code]....
I can observe instead of two children(as I expect) processes there are three. This is because child process 4356 creates its own child. Why all the messages of the type "This is child X i=Y" are concentrated one under another? How exactly fork works? Is affected by the fact that I have a dual-core processor?
View 3 Replies
View Related
Sep 1, 2011
I have been using proftp for about 8 months. After getting the configuration right, it worked perfectly. It is only used intermittently, so I don't know for sure when the problems started, but I suspect it was triggered by a recent OS upgrade to Ubuntu 10.04 (64 bit). I have proftp set up so that TLS is required on both the data and control channels. The problem is that, after successful login, the server seems to be terminating the session because the client (FileZilla) is attempting to renegotiate something (probably the TLS). The client settings didn't change, nor did the server settings.
I have tried switching off the TLSRequired flag, and am then able to establish a non-secure FTP session which works (but that does not meet my requirements). I wondered whether the OS upgrade had somehow invalidated my TLS certificates, but the symptoms don't seem consistent with that cause. The TLS part of my proftpd.conf file is:
[Code]...
View 5 Replies
View Related
Sep 28, 2010
i want a process that can operate as both a TCP echo server and a UDP echo server. The process can provide service to many clients at the same time, but involves a single process that does not start up any other threads.
View 3 Replies
View Related
Sep 19, 2009
I have installed recently the Fedora 8 in a computer and during installation it was set a static IP with the netmask and gateway. At first it worked well, but after some boots the connection begins to fail. It seems that the network-manager withdraws the static IP and tries
to get connection via DHCP. Below is the /var/log/messages file during the failed connection:
Code:
Sep 19 10:36:53 canario avahi-daemon[1695]: Interface eth0.IPv4 no longer relevant for mDNS.
Sep 19 10:36:53 canario avahi-daemon[1695]: Withdrawing address record for fe80::20d:87ff:fe0c:355f on eth0.
Sep 19 10:36:53 canario NetworkManager: <info> SWITCH: terminating current connection 'Auto Ethernet (eth0)' because it's no longer valid.
Sep 19 10:36:53 canario NetworkManager: <info> Deactivating device eth0.
Sep 19 10:37:07 canario system-config-network[2195]: -+ //etc/modprobe.conf #011eth0 alias sis900 .....
View 5 Replies
View Related
Feb 17, 2011
Do you know the GNOME Panel applet that is terminating running applications after clicking on them with the cursor and confirming the action with a Yes/No dialogue?I know about xkill, but it is not satisfying due to it has not confirmation dialogue.Instead, I would like to use xprop and kill and zenity
View 5 Replies
View Related
Feb 12, 2010
How do I create a launcher/shortcut on Gnome desktop, which starts a Terminal window and executes a shell script?The script should execute as if I started the script manually, i.e. if I abort the script by pressing CTRL + C, the script should terminate but the terminal window should remain on screen.If I create the shell script launcher/shortcut using the �straight forward �Create Launcher� method�, the terminal window also closes when I hit CTRL + C
View 8 Replies
View Related
Sep 18, 2010
I'm using Alarm-clock, not the alarm-clock-applet, and when i set Schedulle > AllWekdays an AllMonths the alarm gives me two pop-ups
View 1 Replies
View Related
Jan 31, 2011
I tried to get process ID using pidof. It didn't give any error but a blank output at console Code: $ pidof -s instance1
$
But when I use ps -ef, I get the process ID Code: $ ps -ef | grep instance1
root 4174 21661 0 06:52 pts/1 00:00:00 grep instance1
provgw 30220 30219 28 06:46 pts/1 00:01:44 /usr/java/jdk1.6.0_18/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
[Code].....
View 5 Replies
View Related
Jan 11, 2011
I'm programming a software system that consists of multiple processes. It is programmed in C++ under Linux. and they communicate among them using Linux shared memory.
Usually, in software development, is in the final stage when the performance optimization is made. Here I came to a big problem. The software has high performance requirements, but in machines with 4 or 8 CPU cores (usually with more than one CPU), it was only able to use 3 cores, thus wasting 25% of the CPU power in the first ones, and more than 60% in the second ones. After many, many research, and having discarded mutex and lock contention, I found out that the time was being wasted on shmdt/shmat calls (detach and attach to shared memory segments). After some more research, I found out that these CPUs, which usually are AMD Opteron and Intel Xeon, use a memory system called NUMA, which basically means that each processor has its fast, "local memory", and accessing memory from other CPUs is expensive.
After doing some tests, the problem seems to be that the software is designed so that, basically, any process can pass shared memory segments to any other process, and to any thread in them. This seems to kill performance, as process are constantly accessing memory from other processes.
Now, the question is, is there any way to force groups of process to execute in the same CPU?. I don't mean to force them to execute always in the same processor, as I don't care in which one they are executed, but that would do the job. Ideally, there would be a way to tell the kernel: If you schedule this process in one processor, you must also schedule this "brother" process (which is the process with which it communicates through shared memory) in that same processor, so that performance is not penalized.
View 1 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
Oct 20, 2010
Is there a way to send/receive messages between 2 process using copy_from_user and copy_to_user ? I'm looking for some article, but did not found anything.
View 1 Replies
View Related
May 18, 2010
I've had a very colorful morning learning the innerparts of Linux's sort command, and have come across yet another issue that I can't seem to find an answer for in the documentation. I'm currently using -t, to indicate that my fields are split by the comma character, but I'm finding that in some of my files, the comma is used (between double-quotes) within values:
Jonathan Sampson,,foo@bar.com,0987654321
"Foobar CEO,","CEO,",ceo@foobar.com,,
How can I use a comma to terminate my fields, but ignore the occurences of it within values? Is this fairly simple, or do I need to re-export all of my data using a more-foreign field-terminator? (Unfortunately, I do not have any control over declaring a different terminator with this particular project).
View 2 Replies
View Related
May 29, 2010
I'm completely new to scripting and I'm trying to figure out how to write a script that will get a list of all the files in a directorywn through any subdirectories.When I have the list I want to o each file in VI and change the fileformat. So far all I have been able to figure out is that VI can do the batch processing and that "ls -R" gets me the recursive file list. I'm still pretty clueless on how to do the batch process with the VI editor. I think I'm supposed to use the Ex mode but I don't know how to get the list of arguments from the filelist into the editor so they can be processed. If it matters the files were all written in a Windows editor and have gotten the MS carriage returns so I want to do a :set ff=unix command on all the files without having to go into each file manually, there are over 300 files that need updated.
View 3 Replies
View Related