Home  
Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
44 user(s) are online (32 user(s) are browsing Forums)

Members: 3
Guests: 41

orgin, yescop, Outcast, more...
Support us!
Recent OS4 Files
OS4Depot.net





Process number question (DOS scripts)
Home away from home
Joined:
2006/11/26 21:45
From A haunted Castle somewhere in the Bavarian Mountains
Posts: 2930
Is there a way to give a process a chosen number, so i can "brek" it afterwards without findng out it's number first?

I'm starting a process within a DOS script (a samba share) which depends on the server being online.

smbfs has a timeout which is nice end easy enough to use for mounting the share (once it becomes available in the LAN), but if the server goes down again, the smbfs share will stay on screen, albeit not available (which is annoying).

I'd like to "break" it's process by checking for it's online status...the checking i have figured out, but breaking an unknown process number is impossible.

The process in my example is called
Process 16: Loaded as command: smbfs '//PHENOMIIX4/SambaShare/'

and there is always at least one more smbfs process running.

...Also "break" has an undocumented (AmigaOS4 wiki) option called "name".
I guess it's meant to break processes by the name?
That doesn't work though.

Any ideas?

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
   Report Go to top

Re: Process number question (DOS scripts)
Just can't stay away
Joined:
2006/12/1 18:01
From Copenhagen, Denmark
Posts: 1037
@Raziel

To the best of my knowledge, the user has no control over the process numbers, so that's not an option.

You should be able to use the NAME option, though.

Try entering "help break" in the shell, it should give you the documentation.

Specifically these sections:

---8<---
A process can be signalled by giving a name or a wildcard pattern.
The name will be compared against the program's name (including
its full path, if available) and the program name (excluding the
path), if the first test did not produce a match.
---8<---

- and:

---8<---
1> BREAK NAME "DIR#?"

sets the Ctrl-C attention flag of all processes whose names begin with
the letters "DIR"; this would include the "DIR" program, for example.
---8<---

- should be helpful.

Best regards,

Niels

   Report Go to top

Re: Process number question (DOS scripts)
Quite a regular
Joined:
2009/4/28 3:57
From Adelaide, Australia
Posts: 870
Easy!

Run <>NIL: Run >PIPE:PID programhere

Break "`rx "Open(A,'PIPE:PID','R');SAY Strip(Word(ReadLn(A),2),,']');Close(A)"`"

*cough*

   Report Go to top

Re: Process number question (DOS scripts)
Home away from home
Joined:
2006/11/26 21:45
From A haunted Castle somewhere in the Bavarian Mountains
Posts: 2930
@MickJT



Nice idea, but it only works for the first time i run the program.

All following times i get a BREAK: bad number

@nbache

Will do, thanks for the hint

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
   Report Go to top

Re: Process number question (DOS scripts)
Quite a regular
Joined:
2009/4/28 3:57
From Adelaide, Australia
Posts: 870
It'll probably work if you used T:PID instead of PIPE:PID

It was sort of a joke answer anyway. It might work, but looks unprofessional :)

The Run command will give you the process number of the command it's running, so "Run >T:PID programhere" will send the process number to T:PID, although you probably want to run the server and return to shell, hence "Run <>NIL: Run >T:PID programhere"

Edit: I don't know what I was thinking with two Runs 1 is sufficient.


Edited by MickJT on 2017/12/27 15:22:11
   Report Go to top

Re: Process number question (DOS scripts)
Home away from home
Joined:
2006/11/26 21:45
From A haunted Castle somewhere in the Bavarian Mountains
Posts: 2930
@MickJT

Actually i was using your line and peeped it up a bit so i get the process number and be able to break the process afterewards.

It does work, but there is a small nuisance.

If i start the line from shell it works and writes everything i need to T:, but if i put the same line in a DIS script a blank file is written instead of the information.

Need to investigate...

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
   Report Go to top

Re: Process number question (DOS scripts)
Quite a regular
Joined:
2009/4/28 3:57
From Adelaide, Australia
Posts: 870
@Raziel

A line like "Run <>NIL: Run >T:PID program" is going to need a very small delay before you read T:PID, because it's going to exit to shell first before T:PID has been written. I haven't tried it in an AmigaDOS script myself, but that's probably the issue.

   Report Go to top

Re: Process number question (DOS scripts)
Home away from home
Joined:
2006/11/26 21:45
From A haunted Castle somewhere in the Bavarian Mountains
Posts: 2930
@MickJT

Got it, now it does work.

Unfortunately i can't use that idea, because it will be the process number from the very first start.

But i need it inside my script, as there is the possibility that the program is closed from within the script and reopend on demand,

If i use your run line inside the script, it will obviously kill all the following IF loops that rely on the output of the program start (e.g. a timeout error).

Hrmpf...need to try and rewrite it completely in arexx with file I/O then

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
   Report Go to top

Re: Process number question (DOS scripts)
Quite a regular
Joined:
2009/4/28 3:57
From Adelaide, Australia
Posts: 870
@Raziel

For some reason I thought there was a difference between 1 and 2 Runs. You can use Run >T:PID program >T:Out.txt and the process ID will output to T:PID, return to shell when T:PID has been written (no delay needed) and T:Out.txt will contain the output from the program. You won't know when the program has finished running though. PIPE: might come in handy if it makes ReadLn() wait until there's new data.

   Report Go to top

Re: Process number question (DOS scripts)
Home away from home
Joined:
2006/11/26 21:45
From A haunted Castle somewhere in the Bavarian Mountains
Posts: 2930
@MickJT

I think i need to irc you...will do that at some point and squeeze all the knowledge about scripts out of you

Thank you for the hints

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
   Report Go to top

Re: Process number question (DOS scripts)
Just can't stay away
Joined:
2008/1/6 17:56
From Pennsylvania, USA
Posts: 1253
@Raziel

;AmigaDOS script
Set process `Run <NIL: *>NIL: clock >NIL:`
echo $process


Edited by xenic on 2017/12/27 21:41:06
_________________
Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450

   Report Go to top

Re: Process number question (DOS scripts)
Home away from home
Joined:
2006/11/26 21:45
From A haunted Castle somewhere in the Bavarian Mountains
Posts: 2930
@xenic

Uh, another way...thank you

Will have to try that one too

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
   Report Go to top

Re: Process number question (DOS scripts)
Just can't stay away
Joined:
2008/1/6 17:56
From Pennsylvania, USA
Posts: 1253
@Raziel

I put in an accidental >NIL: but corrected it.

_________________
Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450

   Report Go to top

Re: Process number question (DOS scripts)
Home away from home
Joined:
2006/11/26 21:45
From A haunted Castle somewhere in the Bavarian Mountains
Posts: 2930
@xenic

Thank you

_________________
If slaughterhouses had glass walls, everyone would be a vegetarian. ~ Sir Paul McCartney
-
Did everything just taste purple for a second? ~ Philip J. Fry
-
Ain't got no cash, ain't got no style, ladies vomit when I smile. ~ Dr. John Zoidberg
   Report Go to top





[Advanced Search]


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project