LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy
User Name
Password
Puppy This forum is for the discussion of Puppy Linux.

Notices


Reply
  Search this Thread
Old 03-15-2016, 08:19 PM   #1
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Rep: Reputation: 169Reputation: 169
Kill a running script


I know about killing a process using the PID.

I am looking for a way to search for the bash process that is running, and kill it.

This is an example of what I want to kill.

while sleep 5; do (date=`date` && gxmessage -timeout 1 $date &) ; done
 
Old 03-15-2016, 08:29 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,375
Blog Entries: 28

Rep: Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162Reputation: 6162
If the bash process is a script, ps ought to list it, even if it's sleeping.

I just tested that with a little script that I run to change my background every 30 minutes.
 
Old 03-15-2016, 08:40 PM   #3
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
I want to kill it without using ps.
 
Old 03-16-2016, 04:32 PM   #4
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
This is supposed to exit when Ctrl C is hit, but it does not.

What is wrong ?

Code:
while sleep 5; do (date=`date` && gxmessage -timeout 1 $date &) ; done 

trap 'echo you hit Ctrl-C/Ctrl-\, now exiting..; exit' SIGINT SIGQUIT
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash script how kill app running in bg that was started by the script porphyry5 Programming 2 07-26-2014 01:18 PM
sh: pkill/kill a given running script? Xeratul Programming 2 09-23-2012 06:01 AM
[SOLVED] Kill process(es) of a running script cymplecy Linux - Newbie 8 08-03-2012 01:53 PM
Shell Script to start a program either not running or kill if running avataratar Linux - Newbie 1 03-29-2012 02:45 AM
script/command to kill processes running on particular port varunbihani Linux - General 2 07-08-2005 03:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy

All times are GMT -5. The time now is 08:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration