The state of Ubuntu on Windows
-
@wft said in The state of Ubuntu on Windows:
What if I want a normally-GUI program that I can run in batch mode, feeding its data from STDIN? I guess I'm gonna be told to fuck off.
Fuck off.
Seriously, though, that's (one of the many reasons) quality developers will separate the logic of the application from the interface of the application. In that case, you simply put your data processing logic in a shared library, then create two interfaces to it: one of which is a service, one of which is a console application. You'd have to test both code-paths anyway, so combining the two into one mega-app isn't going to save you anything.
In any case, if you wanted to do that and (say) you didn't have the source code of this console application you're running batches with, simply set it up as a Scheduled Task. Which can run under any user account with or without a desktop. It even has service-like features like being able to restart the process if it crashes or fails. Windows has solved that problem about, oh, 15 years ago. There's more than one tool in the box.
@wft said in The state of Ubuntu on Windows:
You have different code paths depending on how you run the program, because that's how you roll: your application must be aware of all the ways you want to run it.
While technically true, if you wrote the program correctly, you could test the batch processing logic using the console application, and then when you created a Service using that same batch processing DLL, you'd only have to debug the Service-specific parts. (Which are typically super-simple. Does it run when I hit run? Does it stop when I hit stop? Does it pass the right data into the DLL? Does the DLL output the right data/file?)
EDIT: and like ProUck says, you can easily attach a debugger to a Service if you're running in the same user account as it (or a user account that has permissions to attach a debugger to it). A lot of Windows developers run Visual Studio as Admin, to give them the ability to attach a debugger to IIS (which is a Service) and test their REST APIs or whatever.
@wft said in The state of Ubuntu on Windows:
Until recently, because systemd simplified things quite a lot. I still hear diehards bickering about it, but fuck them, really.
The hilarious part (and probably why most Linux users are bitching about it) is that systemd basically implements the exact features Windows has had for 20 years.
-
@wft said in The state of Ubuntu on Windows:
Why is there a difference? If I run my program as a service, the output pretty damn sure must go somewhere unless I explicitly silence it.
Services don't have UIs. Consoles are UIs. Therefore, Services don't have consoles. It's not difficult.
-
@blakeyrat I think there's an unexamined assumption in what @wft is saying, which is that logging should be sent to the console. Which is stupid as these "logs" would disappear when the console window is closed. That's why Windows has an event logger for logging events
-
@Jaloopa said in The state of Ubuntu on Windows:
@blakeyrat I think there's an unexamined assumption in what @wft is saying, which is that logging should be sent to the console.
But... Windows Services don't have a console. They don't have any kind of UI at all.
They can write log files (in the right paths), and they can insert into the Event Log. But neither of those are UIs.
Why would you expect an application that explicitly does not have a UI to write to a console? That boggles my mind.
@Jaloopa said in The state of Ubuntu on Windows:
Which is stupid as these "logs" would disappear when the console window is closed.
99.99999999999999% of the time people aren't using "net run" in a console to start a Service. And even if they did, that doesn't necessarily mean the Service will start in the same user account as the open console-- in fact it's virtually guaranteed not to. So the Service still has no access to any UI.
Considering there's something like a billion Windows PCs out there, and they all run a couple dozen Services on reboot, I might need to add more 9's up there...
EDIT: what's weird to me is that Linux has all these same features, more or less, too. It has systemd to run Services, it has the ability for user A to run a program as user B using su or sudo. It has the ability to run programs in user accounts with no UI. So why do Linux users get confused when Windows uses these same exact features in a logical way?
AFAICT the only difference here is that apparently, according to wft, Linux programs executed as a Service will still have a console, and their console output won't disappear into the ether. If he's correct. But I'd wager he's wrong about that... I think they'd explicitly need to implement a logging library instead, just like a Windows Service would need to implement Windows' Event Log.
-
@blakeyrat said in The state of Ubuntu on Windows:
But... Windows Services don't have a console.
I think there's an unexamined assumption in what @Jaloopa and you are saying, which is that stdout / stderr are consoles.
-
@blakeyrat said in The state of Ubuntu on Windows:
AFAICT the only difference here is that apparently, according to wft, Linux programs executed as a Service will still have a console, and their console output won't disappear into the ether.
Exactly.
@blakeyrat said in The state of Ubuntu on Windows:
I think they'd explicitly need to implement a logging library instead, just like a Windows Service would need to implement Windows' Event Log.
Nope, that's exactly what you don't have to do. Everything you send to stdout/stderr is treated as a log message.
-
@flabdablet said in The state of Ubuntu on Windows:
That, and the fact that it does too much complicated work inside Pid 1.
Lennart claims that systemd does very little in PID 1 itself. I CBA to check whether that's true, though.
-
@blakeyrat said in The state of Ubuntu on Windows:
AFAICT the only difference here is that apparently, according to wft, Linux programs executed as a Service will still have a console, and their console output won't disappear into the ether.
I think that's more a systemd thing than a linux thing, to be honest. Linux has logging libraries too, and has had for ages.
@blakeyrat said in The state of Ubuntu on Windows:
So why do Linux users get confused when Windows uses these same exact features in a logical way?
I think it's a difference of perspective.
- windows fans: Services and applications are fundamentally different things that happen to mostly use the same interfaces.
- linux fans: Services and applications are fundamentally the same thing, but they are used differently.
Even systemd will cry foul if you install a quickly-terminating script as a service. It doesn't expect special entry points, but it does expect certain behaviour (like staying running on the same pid) and will require extra annotation if EG the service daemonizes itself, or is a one-off job that will exit quickly.
-
@asdf said in The state of Ubuntu on Windows:
Everything you send to stdout/stderr is treated as a log message.
Do they go into a database, like they do in Windows? Or just big-ass text files? Now you've made me curious.
Like, is there some way to search "every error code 5763 from service internetsvc between 4/5/2016 and 5/5/2016"? Or are you just stuck with grep and have to hope and pray the guy who wrote internetsvc didn't suck at his job and actually added dates?
-
@PleegWat said in The state of Ubuntu on Windows:
windows fans: Services and applications are fundamentally different things that happen to mostly use the same interfaces.
But they are different things. Services have no UI. By design. Applications do.
Now you may argue that that's not enough of a difference to require different entry points to the application, but... it's a pretty goddamned HUGE difference.
Linux just kind of fudges it's shitty CLI so instead of a user interface, it's a "it's a user interface kind of unless a service is using it, in which case it magically morphs into a logging interface I guess". Fudging like that sucks, it's not behavior to be cheered, it should be shunned.
If you have an API (
Console.WriteLine()
) that does X, it should always do X, not "X unless it's a service, in which case Y. Oh and you have no way of detecting that, developer, good fucking luck!"
-
@blakeyrat said in The state of Ubuntu on Windows:
Oh and you have no way of detecting that,
Except you can detect it. And acting on that rarely makes it better.
-
@PleegWat said in The state of Ubuntu on Windows:
Except you can detect it. And acting on that rarely makes it better.
I dunno; there's a lot of stuff you'd want in a service log that you wouldn't necessarily want in console output. To give one very basic example, the name of the service/application.
If I run internetsvc and see:
2016-04-11 00:00:11 - internetsvc - error 4626 - spaghetti not defined as pasta 2016-04-11 00:00:45 - internetsvc - error 4626 - spaghetti not defined as pasta 2016-04-11 00:12:38 - internetsvc - error 4626 - spaghetti not defined as pasta 2016-04-11 00:14:00 - internetsvc - error 4626 - spaghetti not defined as pasta 2016-04-11 00:17:54 - internetsvc - error 4626 - spaghetti not defined as pasta
The "internetsvc" there is utterly useless.
But if that logging is going to be crammed into a mega-text-file, then I need it to be able to make any kind of rational sense of those lines.
So yes, you quite possibly do need to log different things based on whether its run as a service or an application. (Unless you're on Windows, in which case you can
EventLog()
the correct thing, andConsole.WriteLine()
the correct thing, and never the two shall meet.)
-
@blakeyrat said in The state of Ubuntu on Windows:
Do they go into a database, like they do in Windows? Or just big-ass text files? Now you've made me curious.
Since systemd, you have an actual database.
Like, is there some way to search "every error code 5763 from service internetsvc between 4/5/2016 and 5/5/2016"?
You can definitely query the output of a specific program between two specified dates:
journalctl -u httpd --since=00:00 --until=9:30
systemd also attaches other metadata to log entries, which you can use in queries. Most of that is automatically generated by systemd itself (environment the service was run in etc.), but you can also store metadata yourself. IDK how that works, though, to be honest.
-
@asdf said in The state of Ubuntu on Windows:
Since systemd, you have an actual database.
Well that's good I suppose.
The more I learn about systemd, the more I'm shocked that:
- The state of services/logging/etc in this "enterprise server room OS" was so fucking awful until just a couple years ago, and
- Linux users actually oppose it. These changes are WAY overdue, by decades.
-
@blakeyrat said in The state of Ubuntu on Windows:
Linux users actually oppose it.
That's a vocal minority which is getting smaller every minute, as people get used to systemd. Most sane people only bitch about certain implementation details and design decisions in systemd, not about the concept.
-
@boomzilla said in The state of Ubuntu on Windows:
It seemed like a jumble of chaos! Granted, I think I was 10 years old at the time.
Not sure if times have changed all that much, TBH.
-
@asdf To be fair, there are syslog implementations that keep an actual database. Especially useful when you aggregate stuff from dozens of machines in a cluster.
-
@blakeyrat said in The state of Ubuntu on Windows:
While technically true, if you wrote the program correctly, you could test the batch processing logic using the console application, and then when you created a Service using that same batch processing DLL, you'd only have to debug the Service-specific parts. (Which are typically super-simple. Does it run when I hit run? Does it stop when I hit stop? Does it pass the right data into the DLL? Does the DLL output the right data/file?)
You can also make an app that can run as console app in debugger, or a service normally.
static class Program { static void Main() { if (Environment.UserInteractive && System.Diagnostics.Debugger.IsAttached) { RunInteractiveService(new ServiceTest()); } else { ServiceBase.Run(new ServiceBase[] { new ServiceTest() }); } } static void RunInteractiveServices(ServiceBase service) { Console.WriteLine(); Console.WriteLine("Starting the service in interactive mode."); Console.WriteLine(); service.OnStart(); Console.WriteLine(); Console.WriteLine("Press a key to stop..."); Console.ReadKey(); Console.WriteLine(); service.OnStop(); Console.WriteLine(); Console.WriteLine("Service stopped."); if (System.Diagnostics.Debugger.IsAttached) { Console.WriteLine(); Console.Write("=== Press a key to quit ==="); Console.ReadKey(); } } }
I imagine you can also trigger this by a command line switch instead of the presence of debugger.
-
@accalia said in The state of Ubuntu on Windows:
I assume there's some utility out there that can do that too.
NSSM
-
@RaceProUK said in The state of Ubuntu on Windows:
I don't think I know anyone who has [worked with Indians]
-
I think I hear/see "do the needful" from the English at work more often than the Indians.
-
@asdf said in The state of Ubuntu on Windows:
From a user's POV, everything that continually loops in the background is a service, whether it has a GUI and runs under an actual user account or not. So why does Windows have to treat them so differently and make users look in multiple different places if they want to figure out what services there are on their system?
Because a service can run even when nobody's logged in. Background programs generally can't.
-
@FrostCat
The Devil's Avocado says that to the user it doesn't matter because he isn't logged on so it's a falling tree in a forest without anybody around
-
Seems the phrase has been around for over 300 years: http://en.wikipedia.org/wiki/Do_the_needful
-
@RaceProUK said in The state of Ubuntu on Windows:
, the Service Manager requires the signal handlers
It's a bit ic, but I would consider them more like callbacks. For one thing, signals usually are unexpected conditions, but the handlers for a Windows service are more like normal control indicators (start, stop, pause, etc.)
-
@FrostCat approved
-
@asdf said in The state of Ubuntu on Windows:
finding out which services are configured to run.
You can get that from Task Manager, too, if you aren't ic about what you mean by "configured". More specifically, you can see which services are running and which aren't, although you can't see which ones are set to start up automatically, deferred, manual-only, etc.
@asdf said in The state of Ubuntu on Windows:
Why are services so fundamentally different, only because they don't run in a user's session?
That's a pretty fundamental difference, don't you think? It goes beyond "not running as the user".
-
@Captain said in The state of Ubuntu on Windows:
So that's two places you need to look for service-like tasks.
ry alert: All running startup tasks (those listed on the Startup tab) will show in the (running) process(es) tab as well. So if you just want to see a list of executables, you can, in fact, get it in one place.
Admittedly, if you want to see the configuration, you have (at least) two places, the services snap-in and the startup tab of task manager. Scheduled Tasks, too, if you have stuff set there, now that I think of it.
-
@Captain said in The state of Ubuntu on Windows:
As it stands, I could launch apache from my bashrc. But it would be stupid and awful and pointless. The difference is that on Linux, doing something that dumb is a WTF, while there are at least 4 "blessed" mechanisms for doing it on Windows.
To be fair, though, there's only one "right" way to do that, and Apache comes set up to do it if you use the installer, rather than unpacking a tarball or building from source: it will set up a Windows Service, and a convenience program to start/stop the service.
-
@MHolt said in The state of Ubuntu on Windows:
Ever worked with Indians?
It seems to have originated virally. Someone, probably Indian, used the term, and it was discussed a bit, a while back. Lately a few people have started using it, I assumed as an injoke. I'd like people to stop trying to make this particular fetch happen, though.
-
@Luhmann said in The state of Ubuntu on Windows:
@FrostCat
The Devil's Avocado says that to the user it doesn't matter because he isn't logged onThat's true right until it isn't. :) I've seen people fire up things and then be surprised that they terminate when the user logs off. That usually illustrates the point fairly well, to those willing/able to learn.
-
@loopback0 said in The state of Ubuntu on Windows:
do the needful
I've never heard of this, or this phrase isn't commonly heard by me enough to register under common locale....
-
@FrostCat I'm not talking about on this particular forum.
I've "worked" with Indians from a large consulting agency, and believe me they used it, and without any form of irony.That and massive mail-threads seemed to be their calling card.
-
@MHolt said in The state of Ubuntu on Windows:
@FrostCat I'm not talking about on this particular forum.
I've "worked" with Indians from a large consulting agency, and believe me they used it, and without any form of irony.That and massive mail-threads seemed to be their calling card.
Please remove me from this list.
-
@wft said in The state of Ubuntu on Windows:
generally daemons, at least until now, were written to be able to go into background by themselves
I don't want daemons and evil spirits running around me.
-
@Captain said in The state of Ubuntu on Windows:
@MHolt said in The state of Ubuntu on Windows:
@FrostCat I'm not talking about on this particular forum.
I've "worked" with Indians from a large consulting agency, and believe me they used it, and without any form of irony.That and massive mail-threads seemed to be their calling card.
Please remove me from this list.
Now, 4 months after switching to a different client entirely, I'm still getting CC'ed on communication so often I have a quick button in outlook to mark as read and move.
-
@MHolt Just set up a rule to delete them.
-
@loopback0 said in The state of Ubuntu on Windows:
@MHolt Just set up a rule to delete them.
If you figure out a way to tell outlook to filter on the domain part of the sender email, please let me know.
-
@MHolt http://www.outlook-tips.net/how-to/creating-rules-that-apply-to-an-entire-domain/
Literally the first Google result
-
@RaceProUK said in The state of Ubuntu on Windows:
@MHolt http://www.outlook-tips.net/how-to/creating-rules-that-apply-to-an-entire-domain/
Literally the first Google result
I could've sworn that wasn't there when I last tried.
Oh well, that will be looked into tomorrow morning.
-
@blakeyrat said in The state of Ubuntu on Windows:
@asdf said in The state of Ubuntu on Windows:
Everything you send to stdout/stderr is treated as a log message.
Do they go into a database, like they do in Windows? Or just big-ass text files? Now you've made me curious.
Like, is there some way to search "every error code 5763 from service internetsvc between 4/5/2016 and 5/5/2016"? Or are you just stuck with grep and have to hope and pray the guy who wrote internetsvc didn't suck at his job and actually added dates?
I've not been using Linux for quite some time, so don't know if it's still the case in systemd. However in the SysVInit days, if there are errors in your daemon, write to to stderr and it goes to syslog or whatever logging mechanism currently effective.
And btw, it seems possible to configure rsyslogd to store messages to database such as MySQL .
-
@MHolt said in The state of Ubuntu on Windows:
I could've sworn that wasn't there when I last tried.fuck you I wasn't asking for advice
Oh well, that will be looked into tomorrow morningBTFY
-
@MHolt said in The state of Ubuntu on Windows:
I could've sworn that wasn't there when I last tried.
Outlook's preferences were designed by the same architect as Hogwarts.
-
@cheong said in The state of Ubuntu on Windows:
I've not been using Linux for quite some time, so don't know if it's still the case in systemd. However in the SysVInit days, if there are errors in your daemon, write to to stderr and it goes to syslog or whatever logging mechanism currently effective.
That, of course, hasn't changed, otherwise systemd would have never been adopted. stderr now goes to the journal and optionally syslog, if you still want to use that.
-
@cartman82 Almost any useful daemon I've seen also needed some "special binary executable", or rather some code to handle the service case apart from the non-service case. The effort is approximately the same on Windows (it can likewise be put in a single executable).
Overall systemd did not impress me a lot compared to what SCM does - lots of bells and whistles, but then some fundamental stuff is quite hard to get working right. (But it indeed is an improvement over plain init.)
-
-
@dse Microsoft making a ballyhoo and a brouhaha about "innovations" that consist yet again of adopting features and practices that Unix has had for decades?
Colour me astonished.
:
-
@flabdablet said in The state of Ubuntu on Windows:
Colour me astonished.
I am actually both astonished and impressed. It is hard to accept that you have been doing something wrong specially for a gigantic corporation like Microsoft, and after decades even! I like Microsoft more and more, they contribute to OSS and even Linux kernel. I would not be surprised if one day they open source NT kernel and maybe even start using Linux Kernel! Making money from OS is no longer a big deal (PC is dying), and with the amount of code churn that goes globally into Linux kernel that would be a good cost reduction on their part. Cloud First, also means PC desktop is no longer as profitable.
-
-
@dse said in The state of Ubuntu on Windows:
PC is dying
AGAIN?
Damn it, all these funerals are getting tiring...