Sponsored Content
Special Forums Windows & DOS: Issues & Discussions "background processes" in Windows Post 302912881 by Corona688 on Tuesday 12th of August 2014 12:03:37 PM
Old 08-12-2014
"background processes" in Windows

In order to prevent my Windows machine from trying to start umpteen different applications simultaneously and thrashing to oblivion, I have written this script:

Code:
#!/bin/sh

TODAYFILE="$USERPROFILE/My Documents/$(date +%b%d-%Y.txt)"

[ -e "$TODAYFILE" ] ||
        touch "$TODAYFILE"

# ( notepad.exe "$TODAYFILE" ) &

cd "$USERPROFILE/Start Menu/Programs/Delayed-Start" || exit 1

set -- *.*

while [ "$#" -gt 0 ]
do
        printf "Starting %30s\r" "$1"
        case "$1" in
        *.[sS][hH])
                sh ./"$1" &
                ;;
        *)
                cmd /C "$1" &
                [ -z "$2" ] || sleep 45
                ;;
        esac

        shift
done

echo Done

It is executed by a batch file in my 'Startup' items (and Busybox's help.). It looks for script files, lnk files, or anything else inside my own 'Delayed Start' menu and waits 45 seconds between starting each application, in alphabetical order. I name them 1-firstapp 2-secondapp etc to determine the order.

You will notice one commented out line:
Code:
# ( notepad.exe "$TODAYFILE" ) &

This is because Notepad, unlike most "big" apps, doesn't put itself into the background -- and I can't force it to do so, even with & and a subshell. I guess this is something Windows must do, not something a mere script has power over.

How can I convince Windows to do this?
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

How to include RETURN KEY with Background process "&" in Shell Script

Hello All, I am a newbie in Shell script programming, and maybe you can help me with my query. I need to write a shell script (mntServer.ksh) that will start a background process and also to be able to run another script. The mntServer.ksh script contains: #!/bin/ksh... (1 Reply)
Discussion started by: racbern
1 Replies

3. Windows & DOS: Issues & Discussions

Unix "cut' and "awk" in Windows XP?

Hi, How can I execute Unix's ksh equivalent of "cut' and "awk" in Windows XP? For example, I want to execute ksh commands from Windows command prompt. Is there a place I can download "cut.exe" and "awk.exe" ? Thanks in advance (4 Replies)
Discussion started by: ihot
4 Replies

4. Windows & DOS: Issues & Discussions

"Striping" the background of an Rxvt/Urxvt window in Cygwin

To get this: https://www.unix.com/members/silversleevesx-albums-incidental-shot-glass-picture127-termshot-rxvt-rootless.png out of Cygwin's rxvt, you have to tweak your /cygwin/etc/x11/app-defaults/rxvt file, which is here:... (0 Replies)
Discussion started by: SilversleevesX
0 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

[SOLVED] Using "$!" to get the PID of the Last Ran Background Process

Hello All, I was looking into creating a script that would be used only to start a Daemon and create a lock file... F.Y.I. It's for Nagios' NRPE Daemon Plugin... Anyway when I run the command to start the Daemon (below): /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d And... (14 Replies)
Discussion started by: mrm5102
14 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
GAMMU-SMSD(1)							       Gammu							     GAMMU-SMSD(1)

NAME
gammu-smsd - SMS daemon for Gammu SYNOPSIS
gammu-smsd [OPTION]... DESCRIPTION
This manual page documents briefly the gammu-smsd command. gammu-smsd is a program that periodically scans GSM modem for received messages, stores them in defined storage and also sends messages enqueued in this storage. The daemon can reload configuration file after sending hangup signal (SIGHUP) and properly terminates itself on SIGINT and SIGTERM. Program accepts following options (please note that long options might be not accepted on some platforms): -h, --help Shows help. -v, --version Shows version information and compiled in features. -c, --config=file Configuration file to use, default is /etc/gammu-smsdrc, on Windows there is no default and configuration file path has to be always specified. If you run SMSD as a system daemon (or service), it is recommended to use absolute path to configuration file as startup directory might be different than you expect. See gammu-smsdrc for configuration file documentation. -p, --pid=file Lock file for storing pid, empty for no locking. Not supported on Windows. -U, --user=user Drop daemon privileges to chosed user after starting. -G, --group=group Drop daemon privileges to chosen group after starting. -d, --daemon Daemonize program on startup. Not supported on Windows. -i, --install-service Installs SMSD as a Windows service. -u, --uninstall-service Uninstalls SMSD as a Windows service. -s, --start-service Starts SMSD Windows service. -k, --stop-service Stops SMSD Windows service. -f, --max-failures=count Terminate after defined number of failures. Use 0 to not terminate (this is default). -X, --suicide=seconds Kills itself after number of seconds. -S, --run-service Runs pogram as SMSD Windows service. This should not be used manually, but only Windows Service manager should use this command. -n, --service-name=name Defines name of a Windows service. Each service requires an unique name, so if you want to run several SMSD instances, you have to name each service differently. Default is "GammuSMSD". -l, --use-log Use logging as configured in config file (default). -L, --no-use-log Do not use logging as configured in config file. -e, --install-event-log Installs Windows EventLog description to registry. New in version 1.31.90. -E, --uninstall-event-log Uninstalls Windows EventLog description to registry. New in version 1.31.90. SIGNALS
SMSD can be controlled using following POSIX signals (if your platform supports this): SIGHUP Reload configuration and reconnect to phone. SIGINT, SIGTERM Gracefully shutdown the daemon. SIGALRM Used internally for gammu-smsd -X SIGUSR1 Suspends SMSD operartion, closing connection to phone and database. SIGUSR2 Resumes SMSD operattion (after previous suspend). Changed in version 1.22.91: Added support for SIGHUP. Changed in version 1.22.95: Added support for SIGALRM. Changed in version 1.31.90: Added support for SIGUSR1 and SIGUSR2. EXAMPLES
Linux/Unix Examples Start SMSD as a daemon on Linux: gammu-smsd --config /etc/gammu-smsdrc --pid /var/run/gammu-smsd.pid --daemon Start SMSD as a daemon on Linux with reduced privileges: gammu-smsd --config /etc/gammu-smsdrc --pid /var/run/gammu-smsd.pid --daemon --user gammu --group gammu SMSD as a system wide daemon To use SMSD as a daemon, you might want to use init script which is shipped with Gammu in contrib/init directory. It is not installed by default, either install it manually or check INSTALL file for instructions. Under Windows 7 you might need to disable UAC (user account control) before you will be able to install SMSD service. Windows Service Examples Install Gammu SMSD Windows service: gammu-smsd.exe -c c:Gammusmsdrc -i Install two instances of SMSD Windows service: gammu-smsd.exe -c c:Gammusmsdrc-1 -n Gammu-first-phone -i gammu-smsd.exe -c c:Gammusmsdrc-2 -n Gammu-second-phone -i To uninstall a Windows service: gammu-smsd.exe -u Troubleshooting Windows Service If Gammu fails to start as a Windows service (you will usually get "Error 1053: The service did not respond to the start or control request in a timely fashion"), first check your SMSD logs. If they do not contain any useful hint, try starting SMSD manually with exactly same parameters as you installed the service (without -i). For example the command line can look like: gammu-smsd.exe -c smsdrc You now should be able to get errors from SMSD even if it fails to start as a service. KNOWN LIMITATIONS
You can not use same phone by more programs in same time. However in case you did not enable locking in [gammu] section, it might be able to start the communication with phone from more programs. In this case neither of the programs will probably work. There is no way to detect that SMS message is reply to another by looking at message headers. The only way to achieve this is to add some token to the message and let the user include it in the message on reply. AUTHOR
Michal iha <michal@cihar.com> COPYRIGHT
2009-2012, Michal iha <michal@cihar.com> 1.31.90 February 24, 2012 GAMMU-SMSD(1)
All times are GMT -4. The time now is 10:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy