Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
130 user(s) are online (67 user(s) are browsing Forums)

Members: 0
Guests: 130

more...

Headlines

 
  Register To Post  

Process number question (DOS scripts)
Home away from home
Home away from home


See User information
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?

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: Process number question (DOS scripts)
Just can't stay away
Just can't stay away


See User information
@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

Go to top
Re: Process number question (DOS scripts)
Quite a regular
Quite a regular


See User information
Easy!

Run <>NIL: Run >PIPE:PID programhere

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

*cough*

Go to top
Re: Process number question (DOS scripts)
Home away from home
Home away from home


See User information
@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

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: Process number question (DOS scripts)
Quite a regular
Quite a regular


See User information
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
Go to top
Re: Process number question (DOS scripts)
Home away from home
Home away from home


See User information
@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...

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: Process number question (DOS scripts)
Quite a regular
Quite a regular


See User information
@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.

Go to top
Re: Process number question (DOS scripts)
Home away from home
Home away from home


See User information
@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

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: Process number question (DOS scripts)
Quite a regular
Quite a regular


See User information
@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.

Go to top
Re: Process number question (DOS scripts)
Home away from home
Home away from home


See User information
@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

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: Process number question (DOS scripts)
Just can't stay away
Just can't stay away


See User information
@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

Go to top
Re: Process number question (DOS scripts)
Home away from home
Home away from home


See User information
@xenic

Uh, another way...thank you

Will have to try that one too

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: Process number question (DOS scripts)
Just can't stay away
Just can't stay away


See User information
@Raziel

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

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

Go to top
Re: Process number question (DOS scripts)
Home away from home
Home away from home


See User information
@xenic

Thank you

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project