LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-07-2010, 06:15 PM   #1
deathmaggot
LQ Newbie
 
Registered: Dec 2010
Posts: 5

Rep: Reputation: 0
scheduling process in the foreground?


hi!

Is it possible to schedule a process in the foreground?

Lets say a cron schedule to be ran at 9:00.

I would like to come back at 9:30, see how the process is running, and being able to interact with it... lets say kill it, or whatever...

is it possible?
(its not necessary to use cron, but it must be in COMMAND LINE)
 
Old 12-07-2010, 06:44 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
No, not as such. You could use "screen" from within cron,
and run the process detached, and later on re-attach the
session.


Cheers,
Tink
 
Old 12-08-2010, 05:55 AM   #3
deathmaggot
LQ Newbie
 
Registered: Dec 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Tinkster View Post
No, not as such. You could use "screen" from within cron,
and run the process detached, and later on re-attach the
session.


Cheers,
Tink
i have used screen before, but i can figure it out how to mix screen and cron to get what i want, please, describe.
 
Old 12-08-2010, 06:09 AM   #4
prodev05
Member
 
Registered: Jul 2009
Location: Planet Earth
Distribution: Unix & Linux Variants
Posts: 304

Rep: Reputation: 20
To monitor a single process. Do the following.

1 -->) top -p <PID> // This command will monitor the process in the top format.

2 -->) watch -n 1 " ps -aef | grep -i <PID> " // This command will monitor the process in watch format.

3 -->) strace -p <PID> // This command will trace a particular process and debug.


First try all these step for a specific process. Based on that you can choose your command. For more information refer man page.

Best Regards

Last edited by prodev05; 12-08-2010 at 06:10 AM. Reason: small correction
 
Old 12-08-2010, 10:04 AM   #5
deathmaggot
LQ Newbie
 
Registered: Dec 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by prodev05 View Post
To monitor a single process. Do the following.

1 -->) top -p <PID> // This command will monitor the process in the top format.

2 -->) watch -n 1 " ps -aef | grep -i <PID> " // This command will monitor the process in watch format.

3 -->) strace -p <PID> // This command will trace a particular process and debug.


First try all these step for a specific process. Based on that you can choose your command. For more information refer man page.

Best Regards

and how to catch the PID of the background running process?
 
Old 12-08-2010, 10:28 AM   #6
chickenjoy
Member
 
Registered: Apr 2007
Distribution: centos,rhel, solaris
Posts: 200

Rep: Reputation: 30
Quote:
Originally Posted by deathmaggot View Post
and how to catch the PID of the background running process?
Most services write their current PID/s in a file dedicated for it. Just need to find that out for the service you want to monitor.

Last edited by chickenjoy; 12-09-2010 at 02:45 AM.
 
Old 12-09-2010, 02:12 AM   #7
prodev05
Member
 
Registered: Jul 2009
Location: Planet Earth
Distribution: Unix & Linux Variants
Posts: 304

Rep: Reputation: 20
there is command to fine the PID. Find the command below.

a.) pidof </usr/sbin/sendmail> // For example, process ID of sendmail will be shown, replace sendmail with your process command with full path (absolute path)

b.) pstree -A // System process tress will be shown.


Cheers
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] Trying to bring back a disowned process to foreground km_009 Linux - Newbie 9 04-18-2013 09:30 AM
how can i bring the backgroud process to foreground ZAMO Linux - Enterprise 10 03-05-2012 10:35 AM
how to move background process to foreground batola Linux - Server 29 03-10-2010 11:28 AM
background process popping up in foreground noir911 Linux - General 1 12-15-2007 12:53 AM
How to know the foreground process group ID of another console ?? sreeramabsc Linux - General 0 01-30-2006 02:26 AM


All times are GMT -5. The time now is 01:24 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration