Question of running app as a service

Everything else that doesn't fall into one of the other PB categories.
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Question of running app as a service

Post by ricardo »

1.- How can i run a program not as a service from a service (my own app running as a service)?
Im running some app as service, but if i tried to run some other app it starts as a service, buts as is not s service is crashes. I want to run from my service app some other app not as a service, its possible?

2.- I read Rings made a service lib, where can i found it?

Thanks in advance
ARGENTINA WORLD CHAMPION
Tommeh
Enthusiast
Enthusiast
Posts: 149
Joined: Sun Aug 29, 2004 2:25 pm
Location: United Kingdom

Post by Tommeh »

1) Yes if you start an app from a service, it trys to start it under the current username (services) in which it can't run, so you have to make it start the program under another username, using runas or equiv

2) Rings NT lib was part of his PB power pack, talk to him about it :-) I dunno if he wants it distributed
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

1) But using runas requieres username/password, right?

2) Which PB power pack? Where is the link to see it?
ARGENTINA WORLD CHAMPION
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

Ricardo, you got a pm from me
SPAMINATOR NR.1
Tommeh
Enthusiast
Enthusiast
Posts: 149
Joined: Sun Aug 29, 2004 2:25 pm
Location: United Kingdom

Post by Tommeh »

Yes it requires username/password, but also as a service, you can create a user :) or hope the guest account is active
Max.
Enthusiast
Enthusiast
Posts: 225
Joined: Fri Apr 25, 2003 8:39 pm

Re: Question of running app as a service

Post by Max. »

ricardo wrote:1.- How can i run a program not as a service from a service (my own app running as a service)?
Im running some app as service, but if i tried to run some other app it starts as a service, buts as is not s service is crashes. I want to run from my service app some other app not as a service, its possible?
A program that you run from within a service does NOT run as service, but as a regular application.

The trouble is, if you run the service as SYSTEM service, other programs run under this account as well, which might prevent it from things, like accessing a network share.

If you want to use a GUI and have users input data, you need to select "allow to interact with service" in the user account.

To bypass the networking restriction, you can have the program run under a seperate account (needs the LogonAsService privilege). But then you get into another trouble: you cannot interact with the GUI (output/input). Not possible except with some very low level hacks.

The usual way, to realize such services - as I assume you want to do is - to split the functionality into 2 parts:

1. The service itself, running as SYSTEM or another (priviledged?) user
2. A helper program, launched at each startup, running as the logged on user.

The service communicates with the helper program, exchanges data and each part does the tasks it can do.

This is how basically all apps run, that require this setup; like Sophos Anti-Virus, NetInstall and so on.
Athlon64 3800+ · 1 GB RAM · Radeon X800 XL · Win XP Prof/SP1+IE6.0/Firefox · PB 3.94/4.0
Intel Centrino 1.4 MHz · 1.5 GB RAM · Radeon 9000 Mobility · Win XP Prof/SP2+IE6.0/Firefox · PB 3.94/4.0
kalau
New User
New User
Posts: 2
Joined: Wed May 11, 2005 9:58 am
Location: Germany

Post by kalau »

So. will it generally be possible to write an app as a service?
Here's what I'm planning: I'm running a web server (win 2003 IIS, .NET framework), and I want to receive data via an explicit port. So my app has to listen to a certain port for any data connection in order to write this data into a mysql database.

But I don't want to bother and check whether the application is running, so I thought of running it as a service, so windows will be able to restart this app automatically if it crashed.

Will this be possible with PB? If so, is there any snippet of code where s.o. already realized something like this kind of service?

Thanks for any hint!

best regards

kalau
FloHimself
Enthusiast
Enthusiast
Posts: 229
Joined: Wed May 14, 2003 3:38 pm
Location: Lüneburg - Germany

Post by FloHimself »

kalau wrote:So. will it generally be possible to write an app as a service?
viewtopic.php?t=14488
My favorite numbers: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
Post Reply