telexiconif i wanted to port a sysvinit script to upstart, is there a page documenting how to do this?05:35
keesjtelexicon: does the script do the stantard start/stop/restart stuff?08:38
keesjI am pretty new to this but what I do is write a very simple job "start on start-myservice , stop on stop-myservice" and put the exec in there08:40
keesjlet me find a simple sample08:40
telexiconit'd be nice if there were a few non-trivial examples on the wiki at least08:41
telexiconfor making scripts for daemons or something08:41
keesjafter that I "emit start-myservice"08:44
keesjbut I agree that there is room for improvement in the docs and specialy examples08:45
keesjI would really like a non sysv example.08:46
telexiconah ok08:46
telexiconwell id like to see converting a standard sysv init script to an equivalent upstart form08:46
keesjtelexicon: the thing really is that the guts of sysv are in the file called inittab , there are the read progams that get started and stopped at a special runlevel08:47
keesjthe "rc" scripts are really implemented differently by every distro.08:47
telexiconbut ubuntu has done away with inittab08:48
keesjtelexicon: yes ,while ubuntu uses upstart it uses a "sysv" like implmentations that emulates the old system08:49
keesjif you have a ubuntu system running you can look in /etc/event.d/ and grep for inittab to see the "hacks"08:50
keesjI am implmenting a state machine based system atm(something like the runlevels but with more possible transitions between the levels)08:52
keesjin other words i am experimenting :PO08:53
keesjI think that what I would like is to have more conventions something like  /etc/upstart/services/[myservice]08:54
keesjand that by default I can call emit myservice-start08:55
keesjeverything is a job in upstart therms. perhaps it is better to wait for somebody with more knowlegde 08:56
keesjOK , I have my next interesting problem :p14:04
keesjI  have an init script that starts two commands in the background and I want to convert that one to "one or tree" jobs14:05
keesjI really wonder how...14:05
keesjis that /etc/upstart/services/[myservice]14:06
keesja good idea anyway?14:06
keesjor can a jobs have multiple exec's?14:07
KeybukI'm not sure what you mean14:09
Keybukcan you be more verbose?14:09
=== kylem_ is now known as kylem
keesjI am trying to replace some old init scripts that performed start_a & start_b &  (if stop killall a killall b)14:50
keesjI kinda like the idea that a service can consit of multiple processes (like the nfs/portmap hell)14:51
Keybukshouldn't they be multiple services?14:52
Keybukwhat benefit would there be for having them as one14:53
Keybukyou need portmap for things other than nfs, for example, so it needs a separate lifecycle14:53
keesjperhaps , I like the idea of being able to star "something" and don't want to know that that something actualy consist of multiple parts14:54
Keybukbut that can be done with events, where each part starts something else?14:54
Keybuke.g. "start dbus" causes all dbus services like NM to start14:54
keesjYes , I think that that would be valid14:55
keesjhow about the /etc/upstart/services/[myservice] idea14:57
keesjor actualy whould/should it be possible to have a "start script and a stop script?14:58
Keybukit is possible14:58
Keybukif you have /etc/event.d/foo14:58
Keybukthen you can do "start foo" and "stop foo"14:58
keesj"emit start foo"14:59
keesjinitctl start foo15:01
Keybukthe latter, not the former15:01
Keybukemit is for making events15:01
Keybukstart/stop are for starting and stopping jobs15:01
Keybukevents can, of course, start and stop jobs15:02
Keybukbut there's a more direct way15:02
keesjthe symlink trics also works  (BTW) so creating a symlink start to initctl15:03
keesjKeybuk: I am holding my breath15:03
Keybukmake install will do that for you15:04
keesjhmm yes, I would love the split the even listener and the services, perhaps just giving them an extention is a good (and compatible) start15:10
keesjFYI this is a part of my "change_handler/state_machine" http://paste-it.net/b33db14/raw/15:13
Keybukerr, what does that do?15:43
Keybukthe way I'd do NFS/portmap would be to have an nfs-server service that starts the actual nfs server15:43
Keybukand in portmap have15:43
Keybuk   start on starting nfs-servre15:43
Keybukso if you "start nfs-server" you get portmap15:43
=== soren is now known as soren_not_joking
=== soren_not_joking is now known as soren_joking
=== soren_joking is now known as soren
* Keybuk cannot figure out what the buggering bollocks a D-Bus VTable is17:42
ion_Must be somehow related to D-Bus flicking you the Vs.17:43
Keybukit's a pointer which is typedef'd to a struct that appears to be internal to D-Bus17:47
Keybukmy test suite continues its long-standing tradition of finding bugs in other people's software18:22
Keybukdbus has this function that tells you whether data is remaining to be dispatched18:22
Keybukso assumedly you do:18:22
Keybuk  while (dbus_connection_get_dispatch_status (conn) == DBUS_DISPATCH_DATA_REMAINS)18:23
Keybuk          dbus_connection_dispatch (conn);18:23
Keybukexcept it turns out that data_remains can be true if there are unparsed bytes in there too18:23
Keybukso you'll be in a loop18:24
Keybukand since dispatch doesn't read(), it'll loop forever18:24
Keybukif you only call dispatch() once, it will only dispatch one message, and will sit at select() for the next incoming message18:24
Keybukactually, I can shorten that still :)18:37
Keybukwhile (dbus_connection_dispatch (conn) != DBUS_DISPATCH_DATA_REMAINS)18:37
Keybuk ;18:37
Keybukthat seems to cure the problem, in fact18:40
keesjKeybuk: the upstart code and nih looks very nice indeed.18:53
keesjwhat kind of tests are you talking about (I also saw a post/news about it)18:54
Keybuklook under the nih/tests and init/tests directories18:56
Keybukor just run "make check"18:56
sadmac_Keybuk: so, what was your final answer wrt the license for the example jobs?20:01
Keybuksadmac_: MIT/X1120:01
Keybuk203             if (! dbus_bus_register (conn, &error)) {20:06
Keybuk(gdb) n20:06
Keybuk204                     nih_dbus_error_raise (&error);20:06
Keybuk(gdb) p error.name20:06
Keybuk$2 = 0x2b367a0d0be8 "org.freedesktop.DBus.Error.NoMemory"20:06
Keybuk(gdb) p error.message20:06
Keybuk$3 = 0x2b367a0d5600 "Not enough memory"20:06
Keybukjust a silly error20:07
Keybukit seems it always adds watches and timeouts to the main loop20:07
Keybukeven if you just want it to block20:07
Keybuk(multi-thread safe I guess)20:07
sadmac_Keybuk: using the dbus C api I see.20:13
sadmac_Keybuk: good. DBus cannot become an excuse for GObject.20:14
KeybukGObject is wrong20:14
Keybukand the dbus bindings to it are actually just as weong20:14
Keybukquest nih% ./test_dbus 20:15
KeybukI have achieved ... A CONNECTION!20:15
sadmac_Keybuk: my initial attemt at writing a little /etc/rc replacement was previously done by someone else with GObject. It was 1/3 the way to working and probably had more code than upstart.20:15
AlexExtremelast time I used GObject it made me want to kill every single glib developer20:16
AlexExtremein fact, i often get that feeling just using glib20:16
sadmac_AlexExtreme: I often get that feeling just laying awake at night20:18
Keybuk*** 20:20
Keybuk*** #upstart is now known as #theglibfanclub20:20
sadmac_glib (adj): showing little forethought or preparation : offhand20:21
sadmac_"lacking depth and substance : superficial <glib solutions to knotty problems>"20:22
Keybukdid you know that it's another word for castration?20:22
KeybukI feel the same way about both20:22
sadmac_Keybuk: so you would rather become a woman than a GNOME developer?20:23
Keybukone is certainly more likely than the other20:24
KeybukI got told "I don't contribute enough" to be a GNOME developer20:24
sadmac_Women tell me that all the time.20:24
AlexExtremeI think my most hated thing about glib is the way that it implements libc functions itself and just sticks g_ in front, and typedefs g<type> to <type> for many types20:26
sadmac_AlexExtreme: its a performance thing. G is a very fast character, because its right next to your pointer finger. So it makes the front of variables quicker.20:27
sadmac_the front is the part in 'high' memory, and glib people believe in doing many things while high20:28
AlexExtrememy iPhone kernel paniced20:30
ion_keybuk: Congrats. :-)20:31
Amaranthglib has gint and such for portability reasons20:32
Amaranthit future proofs the library for new architectures20:32
Keybukhow is gint any more portable than the int type its typedef'd to?!: :)20:32
Amaranthmake sure int is always the same size20:32
Keybukbut it doesn't20:32
Keybukgint is int20:33
Amaranthon a new arch they can change gint to typedef to something else20:33
Keybukbut they don't20:33
Amaranthbut they could :)20:33
Keybukand, the best thing is, C *already* has typedefs for this20:33
Keybukif you *care* about the size20:33
Amarantharen't those C99?20:33
Keybukyes, they're from a C standard that is almost 10 years old20:33
Amaranththat many compilers still don't get right20:33
Keybukin fact, I think C99 was C96 before, so more than 10 years old20:33
Keybukname one20:34
Keybukname a compiler that doesn't get them right that you can actually compile GNOME on :p20:34
Amaranthi think think windows has int1620:34
KeybukMSVC++ is one of the better C99 compilers out there20:34
Keybukit might have other typedefs, but it certainly supports the standard20:34
Amaranthbut this is the stdlib20:34
KeybukSUNWspro certainly supports them20:34
Keybukgcc does20:34
sadmac_Keybuk: gcc doesn't fully support C99, by their own admission. I don't know the discrepancies though. Obviously small.20:35
Amaranthi'm pretty sure windows doesn't have all of them20:35
Amaranthsaw a debian guy bitching about this a couple days ago20:35
Keybukyou certainly don't need to protect the size of "int"20:35
Keybukwhoah!  fat characters!20:36
sadmac_Most people I know that are big into C consider C99 to be a failed standard though.20:36
Amaranthwasn't the main point of C99 to make C and C++ mix better?20:36
Keybuksadmac_: http://gcc.gnu.org/c99status.html20:36
Amaranthalso, glib is rather old...20:36
Amarantheverything might support that stuff now but did it in 2001?20:37
Keybukglib is just over-engineered20:37
Amaranththat too20:37
sadmac_Keybuk: cool.20:37
Keybukit's a library written for writing programs in C for people who don't like writing programs in C20:37
Amaranthjust use vala :)20:37
Keybukeverything C-like is hidden so you can pretend you're writing in G20:37
Keybukwhen, in reality, you probably just wanted C++ in the first place20:37
Keybukor compiled C# or Java20:38
Amaranthbut C++ is evil20:38
Keybukglib is evil ;)20:38
* sadmac_ still needs to learn Objective C20:38
Amaranthslightly less evil :)20:38
Keybukthe difference between C++ and glib in terms of evil is like the difference between Steve Ballmer and Bill Gates20:38
Keybukat least C++ *knows* its evil20:38
sadmac_Java is more evil than C++. C# is somewhere between the two.20:38
AmaranthC# is pretty nice, really20:38
Keybukit wakes up in the morning, has a good manic laugh, and sets out to see what new evil it can bring to the day20:38
Keybukglib just brings the same evil without trying20:39
KeybukC# does generally seem nice20:39
Keybukit was invented by the guy who did Delphi and ObjectPascal20:39
Keybukand I liked them20:39
AlexExtremeit was?20:39
AmaranthI'd rather use C# than C++ because if I'm going to have to deal with that bullshit at least I don't have to deal with memory management and pointers :P20:39
Keybukmy only issue with it is that its interpreted20:39
sadmac_Digital Mars D looks nice, but the implementation just isn't there yet.20:39
AmaranthKeybuk: which vala 'fixes' :)20:39
* sadmac_ looks into vala20:55
KeybukI *think* I have dbus now hooked properly into the nih main loop21:17
Keybukof course, that's the easy bit21:29
Keybuksending messages and handling those you get is the hard bit ;)21:30
Keybuk        server = nih_dbus_server ("unix:abstract=/com/ubuntu/upstart/test");21:55
Keybuk        if (! server) {21:55
Keybuk                err = nih_error_get ();21:55
Keybuk                printf ("ERROR: %s\n", err->message);21:55
Keybuk                exit (1);21:55
Keybuk        }21:55
Keybukahh, a nice API at least21:55
Keybukok, that still needs to have something to handle publishing objects21:57
Keybukbut in theory, all upstart needs to call is nih_dbus_server() to handle direct clients and nih_dbus_system_bus() to handle indirect21:57
sadmac__nih_error_get sounds like a 4chan meme22:28
sadmac__250 ERROR GET!22:28
=== sadmac__ is now known as sadmac

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!