Sponsored Content
Top Forums Shell Programming and Scripting Need to write a shell script that starts one, then kills it, then starts another? Post 302968487 by Scrutinizer on Wednesday 9th of March 2016 08:02:10 PM
Old 03-09-2016
Yes I meant a background process, corrected in my post..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

filename that starts with a space

I accidentally started a filename with a spce and I can not get rid of it. Any words of advice? (6 Replies)
Discussion started by: noobie_doo
6 Replies

2. Shell Programming and Scripting

Delete lines that starts with a certain letter

How can I delete those lines that starts with a certain letter? abc def ghi xyz abc def ace gik moq abe imq gxm I want to delete the line that starts with "x". Thanks! (4 Replies)
Discussion started by: kingpeejay
4 Replies

3. Red Hat

Firefox do not starts from Panel

Hi I am facing a problem related firefox and some other applications like DocumentViewer (evince). I can run the firefox from terminal by just giving command "firefox" but when I made its shortcut in panel and try to run through that panel shortcut , the mouse coursor just becomes busy for... (10 Replies)
Discussion started by: mak_mailbox
10 Replies

4. UNIX for Dummies Questions & Answers

Display lines not starts with #

hiiiii $ grep ^"#" $file Will give the lines , which starts with # .And I wanna get the lines which are not starting with #. How to implement that. Thanking you Krish:b: (10 Replies)
Discussion started by: krishnampkkm
10 Replies

5. UNIX for Dummies Questions & Answers

Why do a unix script starts with a comment?

For eg: #!/usr/bin/ksh <remaining code goes here> .. .. Does the compiler ignores that? Thanks (2 Replies)
Discussion started by: ajincoep
2 Replies

6. Shell Programming and Scripting

Start script when a user starts a remote session

Howdy, I'm fairly new at bash scripting, but (for some reason) I've been tasked with building a bastion server and logging all (ssh/telnet) remote activity. Each session must create a unique log file - the name of each file must include the user ID, the connection method (ssh/telnet), the name... (2 Replies)
Discussion started by: kilo90
2 Replies

7. Shell Programming and Scripting

Check if string starts with $ symbol

How do I check that a string $AA22CC3 starts with the "$" symbol ? I have tried : checksum='$AAB3E45' echo $checksum case $checksum in $* ) echo success ; esac Thanks ... (4 Replies)
Discussion started by: cillmor
4 Replies

8. Shell Programming and Scripting

Detect if script starts from queue

Dear community, what I'm try to do is deny users to run a script without parameters from command bash, but the same script should run without parameters only from crontab. Example runs by crontab:*/5 * * * * /tmp/script.sh Here the normal execution starts every 5 minutes Example #1 runs by... (16 Replies)
Discussion started by: Lord Spectre
16 Replies

9. UNIX for Advanced & Expert Users

Script to rename file that was generated today and which starts with date

hello, can someone please suggest a script to rename a file that was generated today and filename that being generated daily starts with date, its a xml file. here is example. # find . -type f -mtime -1 ./20130529_4995733057260357019.xml # this finename should be renamed to this format.... (6 Replies)
Discussion started by: bobby320
6 Replies

10. Homework & Coursework Questions

When I run the script, the cursor starts on the wrong line?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: It's a shell script using a looping logic, trap, tput, if, while. Most of the scripts in this book aren't written... (2 Replies)
Discussion started by: ckleinholz
2 Replies
GETPRIORITY(2)						      BSD System Calls Manual						    GETPRIORITY(2)

NAME
getpriority, setpriority -- get/set program scheduling priority SYNOPSIS
#include <sys/resource.h> int getpriority(int which, id_t who); int setpriority(int which, id_t who, int prio); DESCRIPTION
The scheduling priority of the process, process group, or user as indicated by which and who is obtained with the getpriority() call and set with the setpriority() call. Which is one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER, and who is interpreted relative to which (a process identifier for PRIO_PROCESS, process group identifier for PRIO_PGRP, and a user ID for PRIO_USER). A zero value of who denotes the current process, process group, or user. prio is a value in the range -20 to 20. The default priority is 0; lower priorities cause more favorable scheduling. The getpriority() call returns the highest priority (lowest numerical value) enjoyed by any of the specified processes. The setpriority() call sets the priorities of all of the specified processes to the specified value. Only the super-user may lower priorities. Additionally, the current thread or process can be placed in a background state by specifying PRIO_DARWIN_THREAD or PRIO_DARWIN_PROCESS for which. Only a value of zero (the current thread or process) is supported for who when setting or getting background state. prio is either 0 (to remove current thread from background status) or PRIO_DARWIN_BG (to set current thread into background state). When a thread or process is in a background state the scheduling priority is set to the lowest value, disk IO is throttled (with behavior similar to using setiopolicy_np(3) to set a throttleable policy), and network IO is throttled for any sockets opened after going into background state. Any previously opened sockets are not affected. The getpriority() call returns 0 when current thread or process is not in background state or 1 when the current thread is in background state. Any thread or process can set itself into background state. RETURN VALUES
Since getpriority() can legitimately return the value -1, it is necessary to clear the external variable errno prior to the call, then check it afterward to determine if a -1 is an error or a legitimate value. The setpriority() call returns 0 if there is no error, or -1 if there is. ERRORS
Getpriority() and setpriority() will fail if: [EINVAL] Which is not one of PRIO_PROCESS, PRIO_PGRP, PRIO_USER, PRIO_DARWIN_THREAD, or PRIO_DARWIN_PROCESS. [EINVAL] Who is not a valid process, process group, or user ID. [EINVAL] Who is not 0 when which is PRIO_DARWIN_THREAD or PRIO_DARWIN_PROCESS. [ESRCH] No process can be located using the which and who values specified. In addition to the errors indicated above, setpriority() will fail if: [EACCES] A non super-user attempts to lower a process priority. [EPERM] A process is located, but neither its effective nor real user ID matches the effective user ID of the caller. LEGACY SYNOPSIS
#include <sys/types.h> #include <sys/resource.h> The include file <sys/types.h> is necessary. int getpriority(int which, int who); int setpriority(int which, int who, int value); The type of who has changed. SEE ALSO
nice(1), fork(2), setiopolicy_np(3), compat(5), renice(8) HISTORY
The getpriority() function call appeared in 4.2BSD. 4th Berkeley Distribution June 4, 1993 4th Berkeley Distribution
All times are GMT -4. The time now is 08:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy