Restart Perl Application upon KDE Restart

Discussion in 'Perl Misc' started by Josef Moellers, Jul 18, 2013.

  1. Under KDE, certain applications register with ksmserver to be restarted
    at the next startup, e.g. when I exit without closing firefox,
    thunderbird, kate, they are all restarted (more or less successful) when
    I relogin.

    They are remembered in ~/.kde/share/config/ksmserverrc

    Is there a way (e.g. using Net::DBus) to have a perl script restarted? I
    doubt that I can just edit ~/.kde/share/config/ksmserverrc.

    Thanks,

    Josef
    Josef Moellers, Jul 18, 2013
    #1
    1. Advertising

  2. define you script here

    /etc/rc.local

    or better converted to linux service

    vi /etc/init.d/myscript
    sub stop {...}
    sub start {...}
    sub status {...}
    sub reload {...}
    sysv-rc-conf --level 345 myscript on
    George Mpouras, Jul 18, 2013
    #2
    1. Advertising

  3. you could also start your script like

    nohup /usr/local/myscript.pl 2> /var/log/myscript.log 1>&2 &
    George Mpouras, Jul 18, 2013
    #3
  4. On 07/18/2013 10:46 PM, Henry Law wrote:
    > On 18/07/13 21:13, George Mpouras wrote:
    >> define you script here
    >>
    >> /etc/rc.local

    >
    > George, I don't think that's what the OP wants. If you read the post
    > you'll see
    >
    >> e.g. when I exit without closing firefox,
    >> thunderbird, kate, they are all restarted

    >
    > So I think what's required is some way to register a Perl application
    > with KDE such that if it is shut down ungracefully (i.e. by the system
    > rather than the user) then KDE will know to restart it.


    Exactly. I *do* know that it's somehow ksmserver's responsibility and
    the applications that are running (and would therefore be eligible for
    restart) are recorded in said ~/.kde/share/config/ksmserverrc, but I
    doubt that I can just modify that file without telling ksmserver!
    >
    > It seems that he also wants some "snapshot" capability which will allow
    > KDE to apply some logic to the restart; in the case of the browser this
    > means opening the pages that were open at the point of shutdown. What
    > that might mean in the case of the Perl application I couldn't say.


    I think it would be OK to just restart the application. Restoring the
    application's internal state might be the application's responsibility,
    e.g. by storing it in an rc file in the user's home directory.

    > That said, I have no idea what the answer is.


    Thanks anyway.

    Josef
    Josef Moellers, Jul 19, 2013
    #4
  5. * Ben Morrow wrote in comp.lang.perl.misc:
    >Quoth Shmuel (Seymour J.) Metz <>:
    >> In <ks9i9d$1bf8$>, on 07/18/2013
    >> at 11:13 PM, "George Mpouras"
    >> <> said:
    >>
    >> >Content-Type: text/plain;
    >> > format=flowed;
    >> > charset="iso-8859-1";
    >> > reply-type=original
    >> >Content-Transfer-Encoding: 7bit

    >>
    >> !

    >
    >Well, strictly speaking CTE isn't valid on Usenet, so it's just a
    >meaningless header...


    <http://tools.ietf.org/html/rfc5536>:

    The MIME header fields MIME-Version, Content-Type, Content-Transfer-
    Encoding, Content-Disposition, and Content-Language are used in
    Netnews articles in the same circumstances and with the same meanings
    as those specified in [RFC2045], [RFC2183], and [RFC3282], with the
    added restrictions detailed above in Section 2.2.
    --
    Björn Höhrmann · mailto: · http://bjoern.hoehrmann.de
    Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
    25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
    Bjoern Hoehrmann, Jul 21, 2013
    #5
  6. On 2013-07-21 16:13, Ben Morrow <> wrote:
    > Quoth Shmuel (Seymour J.) Metz <>:
    >> In <ks9i9d$1bf8$>, on 07/18/2013
    >> at 11:13 PM, "George Mpouras"
    >> <> said:
    >>
    >> >Content-Type: text/plain;
    >> > format=flowed;
    >> > charset="iso-8859-1";
    >> > reply-type=original
    >> >Content-Transfer-Encoding: 7bit

    >>
    >> !

    >
    > Well, strictly speaking CTE isn't valid on Usenet, so it's just a
    > meaningless header...


    RFC 5536, section 2.3:

    | 2.3. MIME Conformance
    |
    | User agents MUST meet the definition of MIME conformance in [RFC2049]
    | and MUST also support [RFC2231].

    RFC 2049, section 2:

    | 2. MIME Conformance
    [...]
    | A mail user agent that is MIME-conformant MUST:
    [...]
    | (2) Recognize the Content-Transfer-Encoding header field
    | and decode all received data encoded by either quoted-
    | printable or base64 implementations. The identity
    | transformations 7bit, 8bit, and binary must also be
    | recognized.

    hp


    --
    _ | Peter J. Holzer | Fluch der elektronischen Textverarbeitung:
    |_|_) | Sysadmin WSR | Man feilt solange an seinen Text um, bis
    | | | | die Satzbestandteile des Satzes nicht mehr
    __/ | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
    Peter J. Holzer, Jul 21, 2013
    #6
  7. George Mpouras, Jul 22, 2013
    #7
  8. Josef Moellers

    Ivan Shmakov Guest

    Content-Transfer-Encoding: vs. Usenet

    >>>>> Shmuel (Seymour J ) Metz <> writes:
    >>>>> on 07/21/2013 at 05:13 PM, Ben Morrow <> said:


    [Cross-posting to news:news.software.readers and setting
    Followup-To: there.]

    >>>> Content-Transfer-Encoding: 7bit


    >>> !


    >> Well, strictly speaking CTE isn't valid on Usenet,


    > It may not be valid for 1036, but it is certainly valid for 5536.
    > Unencoded ISO 8859-1 isn't valid for either.


    Nowadays, I'd assume that every other newsreader out there is
    going to either support the full range of charsets, whether
    encoded or not, or to have little to no MIME support whatsoever.

    Thus, the issue is rather the RFCs' failure to document the
    existing practice, and not some incompliance. (Even though
    unencoded data in general may clash with the NNTP provision that
    any non-ASCII data transferred should be in UTF-8.)

    But the whole point is moot, as "7bit" ISO-8859-1 is just a
    fancy name for ASCII, which is valid since well before MIME.

    --
    FSF associate member #7257
    Ivan Shmakov, Jul 25, 2013
    #8
  9. Re: Content-Transfer-Encoding: vs. Usenet

    Ivan Shmakov <> wrote:
    >>>>>> Shmuel (Seymour J ) Metz <> writes:
    >>>>>> on 07/21/2013 at 05:13 PM, Ben Morrow <> said:

    >
    > [Cross-posting to news:news.software.readers and setting
    > Followup-To: there.]
    >
    > >>>> Content-Transfer-Encoding: 7bit

    >
    > >>> !

    >
    > >> Well, strictly speaking CTE isn't valid on Usenet,

    >
    > > It may not be valid for 1036, but it is certainly valid for 5536.
    > > Unencoded ISO 8859-1 isn't valid for either.

    >
    > Nowadays, I'd assume that every other newsreader out there is
    > going to either support the full range of charsets, whether
    > encoded or not, or to have little to no MIME support whatsoever.
    >
    > Thus, the issue is rather the RFCs' failure to document the
    > existing practice, and not some incompliance. (Even though
    > unencoded data in general may clash with the NNTP provision that
    > any non-ASCII data transferred should be in UTF-8.)
    >
    > But the whole point is moot, as "7bit" ISO-8859-1 is just a
    > fancy name for ASCII, which is valid since well before MIME.


    Here I was, innocently reading news.software.readers, when I came across
    this crosspost written by a self-declared topic moderator. I don't read
    this newsgroup looking for redirected flames and arguments from another
    newsgroup, so this isn't appreciated.

    Furthermore, coming into the middle of this snark fest, I have no idea
    who said what as "Ivan Shamkov" doesn't trouble himself with the niceties
    of matching quoting levels in the body of the level with quoting levels
    in attribution ilnes. According to "Ivan", "Shmuel" and "Ben" both wrote
    quotes at the same quoting level.

    Nor is "Ivan" aware of the concept of an unindented left margin, even for
    quote characters indicating quoting level.

    No followup to my article would be on topic anywhere but in a revenge froup
    for "Ivan", so I've directed followups to the correct newsgroup.
    Adam H. Kerman, Jul 25, 2013
    #9
  10. Shmuel (Seymour J.) Metz <> wrote:
    >on 07/21/2013 at 05:13 PM, Ben Morrow <> said:


    >>Well, strictly speaking CTE isn't valid on Usenet,


    >It may not be valid for 1036, but it is certainly valid for 5536.
    >Unencoded ISO 8859-1 isn't valid for either.


    The mechanism indicated in the Content-Transfer-Encoding header of 7bit
    or 8bit is used with unencoded data, whereas quoted-printable or base64
    is used with data encoded in the named mechanism. I have no idea why you
    believe an author couldn't post an article to Usenet, the body of which
    consists of unencoded Latin-1 characters, without violating syntax.

    In any event, I agree with Ben and continue my boycott of MIME on
    Usenet, not that anyone cares. The syntax of the CTE header, which is
    used to indicate a type of unencoded data OR a mechanism of encoding,
    is ungrammatical to my ear.
    Adam H. Kerman, Jul 25, 2013
    #10
  11. Josef Moellers

    Ivan Shmakov Guest

    Content-Transfer-Encoding: vs. Usenet

    >>>>> Adam H Kerman <> writes:

    [Cross-posting to news:news.software.readers and setting
    Followup-To: there. Adding news:comp.mail.mime, on a second
    though.]

    [...]

    > In any event, I agree with Ben and continue my boycott of MIME on
    > Usenet, not that anyone cares.


    Personally, I don't care about non-MIME articles, as long as
    they're pure-ASCII. The only issues with forgoing MIME
    completely I'm aware of are:

    * pure-ASCII is simply not enough for the majority (90% or so)
    of the world population; (this isn't a problem should Usenet
    be though of as a kind of pure-English sect; but it isn't);

    * use a non-compliant newsreader to quote MIME-compliant
    messages, and havoc will ensue.

    > The syntax of the CTE header, which is used to indicate a type of
    > unencoded data


    Is it?

    > OR a mechanism of encoding, is ungrammatical to my ear.


    --
    FSF associate member #7257
    Ivan Shmakov, Jul 25, 2013
    #11
  12. Re: Content-Transfer-Encoding: vs. Usenet

    Ivan Shmakov <> wrote:
    >>>>>> Adam H Kerman <> writes:


    This quote level in attribution does not match the quote level for the
    quoted remarks written by me.

    > [Cross-posting to news:news.software.readers and setting
    > Followup-To: there. Adding news:comp.mail.mime, on a second
    > though.]


    Not playing followup games. If you think this discussion is off topic,
    why did YOU post a followup to it in this newsgroup?

    >[...]


    >>In any event, I agree with Ben and continue my boycott of MIME on
    >>Usenet, not that anyone cares.


    > Personally, I don't care about non-MIME articles, as long as
    > they're pure-ASCII. The only issues with forgoing MIME
    > completely I'm aware of are:


    > * pure-ASCII is simply not enough for the majority (90% or so)
    > of the world population; (this isn't a problem should Usenet
    > be though of as a kind of pure-English sect; but it isn't);


    > * use a non-compliant newsreader to quote MIME-compliant
    > messages, and havoc will ensue.


    My newsreader expects me to add headers, if necessary. If I must quote
    an article with non-ASCII characters, I cut them. Typically, this happens
    when I encounter articles written by Google Groups users to which
    non-plain-text characters have been added (like non-breaking spaces).
    Not to mention, Google Groups implements MIME badly.

    If I absolutely must quote the 8-bit character, I add MIME headers to
    declare the character set. Otherwise my articles are pure ASCII.

    >>The syntax of the CTE header, which is used to indicate a type of
    >>unencoded data


    > Is it?


    Yes, Ivan, with a literal read, it is used to indicate unencoded data
    type despite the header's name, according to RFC 2045 Section 6.2:
    Content-Transfer-Encodings Semantics

    . . . Three transformations are currently defined: identity,
    the "quoted-printable" encoding, and the "base64" encoding.
    The domains are "binary", "8bit" and "7bit".

    The Content-Transfer-Encoding values "7bit", "8bit", and
    "binary" all mean that the identity (i.e. NO) encoding
    transformation has been performed. As such, they serve simply
    as indicators of the domain of the body data, and provide
    useful information about the sort of encoding that might be
    needed for transmission in a given transport system. . . .

    >>OR a mechanism of encoding, is ungrammatical to my ear.
    Adam H. Kerman, Jul 25, 2013
    #12
  13. Josef Moellers

    Ivan Shmakov Guest

    [OT] Content-Transfer-Encoding: vs. Usenet

    >>>>> Adam H Kerman <> writes:

    [...]

    > If you think this discussion is off topic, why did YOU
    > post a followup to it in this newsgroup?


    Because it's a well-established part of the netiquette.

    Yet another way to keep the subscribers of the (irrelevant)
    group the conversation is being moved from is to send a separate
    followup to it, announcing the followup posted [1].

    Those still interested in the discussion are encouraged to
    subscribe to either news:news.software.readers or
    news:comp.mail.mime. (Which I will post my followups to this
    thread to, if any, from now on. And sorry for the noise.)

    [1] news:

    --
    FSF associate member #7257
    Ivan Shmakov, Jul 25, 2013
    #13
  14. Re: Content-Transfer-Encoding: vs. Usenet

    Ivan Shmakov <> wrote:
    >>>>>> Adam H Kerman <> writes:
    >>>>>> Ivan Shmakov <> wrote:
    >>>>>> Adam H Kerman <> writes:


    Followup posted to comp.lang.perl.misc as that's where the thread is. I can't
    think of anything ruder than changing newsgroups in the middle of a thread
    so that the reader sees only some of the articles.

    I continue to object to your attribution lines and your refusal to use
    correct quoting levels so the reader can readily tell who said what.

    >[...]


    > >> [Cross-posting to news:news.software.readers and setting
    > >> Followup-To: there. Adding news:comp.mail.mime, on a second
    > >> though.]


    >[...]


    > > If you think this discussion is off topic, why did YOU


    > ... And when Followup-To: is then ignored, is the expectation
    > that two wrongs will make a right? Or is a failure of one
    > poster to behave is a license to do so for everyone else?


    Setting Followup-To is a suggestion, not a directive. The author of the
    followup is still responsible for determining where to post.

    > > post a followup to it in this newsgroup?


    > Because it's a well-established part of the netiquette (which,
    > IIRC, you've been pointed at before): when moving a conversation
    > to another newsgroup, keep the subscribers of the former one
    > informed. One simple way to do it is as follows: add the
    > relevant groups to Newsgroups:, copy the result to Followup-To:,
    > remove the irrelevant ones from the latter (only.)


    > Yet another way is to send a separate followup to the irrelevant
    > newsgroup, which is what I'm going to do for this response.


    There is no well-established part of netiquette that "Ivan Shmakov" has
    either the role or responsibility to act as topic censor in any unmoderated
    newsgroup. Please provide a list of names of anyone who has ever asked you
    to moderate an unmoderated newsgroup.

    >[...]


    > >> The only issues with forgoing MIME completely I'm aware of are:


    > >> * pure-ASCII is simply not enough for the majority (90% or so) of
    > >> the world population; (this isn't a problem should Usenet be though
    > >> of as a kind of pure-English sect; but it isn't);


    > >> * use a non-compliant newsreader to quote MIME-compliant messages,
    > >> and havoc will ensue.


    > > My newsreader expects me to add headers, if necessary. If I must
    > > quote an article with non-ASCII characters, I cut them. Typically,
    > > this happens when I encounter articles written by Google Groups users
    > > to which non-plain-text characters have been added (like non-breaking
    > > spaces).


    > ... Which reminds me of the thing I've used to call the
    > "American Usenet" attitude.


    The A in ASCII stands for American.

    It might have been useful in the 1960's to have included Chinese
    characters or even to include all charactes used by languages that
    use Latin characters, but coding space was extremely limited and most
    characters in use by others got left out.

    However, I don't see what your anti-American sentiment has to do with
    what I wrote. I commented that Google Groups creates articles with
    non-plain-text characters, which under no circumstances belong in
    Usenet articles, no matter what language they were written in. I cut
    such characters from quotes, which then allows me to post a followup in
    nothing but ASCII.

    I don't know why you would have a problem with that, but you're quite a
    strange bird.

    > Naturally, I wouldn't expect one participating in
    > news:tw.bbs.soc.politics, news:pl.comp.os.linux, or
    > news:alt.russian.z1 to find a non-MIME newsreader all that
    > convenient.


    Why not? My newsreader provides default headers for articles. All anyone
    would have to do is add the necessary MIME headers to the default set.
    Then I'd post in compliant MIME if I really needed to declare a character
    set.

    I like the flexibility. Nothing about this newsreader requires the author
    to post in ASCII. The newsreader uses an outside program as text editor
    in the composer anyway, so the author would simply use a text editor
    appropriate for his own use.
    Adam H. Kerman, Jul 25, 2013
    #14
  15. Re: Content-Transfer-Encoding: vs. Usenet

    "Adam H. Kerman" <> writes:
    > Ivan Shmakov <> wrote:
    >>>>>>> Adam H Kerman <> writes:
    >>>>>>> Ivan Shmakov <> wrote:
    >>>>>>> Adam H Kerman <> writes:

    >
    > Followup posted to comp.lang.perl.misc as that's where the thread is. I can't
    > think of anything ruder than changing newsgroups in the middle of a thread
    > so that the reader sees only some of the articles.


    The assumption that 'the reader' necessarily enjoyed the fact that he
    went looking a for something Perl-related but found another instance
    of this tripe instead is wrong.
    Rainer Weikusat, Jul 25, 2013
    #15
  16. Re: Content-Transfer-Encoding: vs. Usenet

    [Fup2 poster. This is off-topic here and I'm not going to try to find
    out where it is on-topic]

    On 2013-07-25 21:54, Adam H. Kerman <> wrote:
    > Followup posted to comp.lang.perl.misc as that's where the thread is. I can't
    > think of anything ruder than changing newsgroups in the middle of a thread
    > so that the reader sees only some of the articles.


    I consider it very rude that you continue to try to push this thread
    into a group where it is clearly off-topic.

    > There is no well-established part of netiquette that "Ivan Shmakov" has
    > either the role or responsibility to act as topic censor in any unmoderated
    > newsgroup. Please provide a list of names of anyone who has ever asked you
    > to moderate an unmoderated newsgroup.


    Neither has anyone appointed you moderator of the groups you are trying
    to "protect". Just stop it.

    hp

    --
    _ | Peter J. Holzer | Fluch der elektronischen Textverarbeitung:
    |_|_) | Sysadmin WSR | Man feilt solange an seinen Text um, bis
    | | | | die Satzbestandteile des Satzes nicht mehr
    __/ | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
    Peter J. Holzer, Jul 26, 2013
    #16
  17. Re: Content-Transfer-Encoding: vs. Usenet

    Rainer Weikusat <> wrote:
    >"Adam H. Kerman" <> writes:
    >>Ivan Shmakov <> wrote:


    >>>>>>>> Adam H Kerman <> writes:
    >>>>>>>> Ivan Shmakov <> wrote:
    >>>>>>>> Adam H Kerman <> writes:


    >>Followup posted to comp.lang.perl.misc as that's where the thread is. I can't
    >>think of anything ruder than changing newsgroups in the middle of a thread
    >>so that the reader sees only some of the articles.


    >The assumption that 'the reader' necessarily enjoyed the fact that he
    >went looking a for something Perl-related but found another instance
    >of this tripe instead is wrong.


    Do you know how to score a thread whose Subject is Content-Transfer-Encoding
    and clearly not Perl related?

    I wasn't speaking for you. I'm the reader in question. I didn't want to
    see Ivan's portions of the thread in news.software.readers, and I'm not
    posting followups as directed by Ivan.
    Adam H. Kerman, Jul 26, 2013
    #17
  18. Re: Content-Transfer-Encoding: vs. Usenet

    Peter J. Holzer <> wrote:

    >[Fup2 poster. This is off-topic here and I'm not going to try to find
    >out where it is on-topic]


    >On 2013-07-25 21:54, Adam H. Kerman <> wrote:


    >>Followup posted to comp.lang.perl.misc as that's where the thread is. I can't
    >>think of anything ruder than changing newsgroups in the middle of a thread
    >>so that the reader sees only some of the articles.


    >I consider it very rude that you continue to try to push this thread
    >into a group where it is clearly off-topic.


    It was topic drift here.

    >>There is no well-established part of netiquette that "Ivan Shmakov" has
    >>either the role or responsibility to act as topic censor in any unmoderated
    >>newsgroup. Please provide a list of names of anyone who has ever asked you
    >>to moderate an unmoderated newsgroup.


    >Neither has anyone appointed you moderator of the groups you are trying
    >to "protect". Just stop it.


    I simply chose not to follow Ivan's re-direction. I get to do that.
    I'm the author.
    Adam H. Kerman, Jul 26, 2013
    #18
  19. Re: Content-Transfer-Encoding: vs. Usenet

    Ben Morrow <> wrote:

    >[I apologise for my part in starting this subthread...]


    [Yet you posted a followup anyway...]
    Adam H. Kerman, Jul 26, 2013
    #19
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vyacheslav Lanovets
    Replies:
    2
    Views:
    3,101
    Juan T. Llibre
    Jul 27, 2005
  2. =?Utf-8?B?Q2hhaW5zYXdEdWRl?=

    retain application variables on application restart

    =?Utf-8?B?Q2hhaW5zYXdEdWRl?=, Feb 3, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    431
    Brock Allen
    Feb 3, 2006
  3. Joseph
    Replies:
    0
    Views:
    353
    Joseph
    Apr 29, 2004
  4. Matthias Pospiech

    rendering bug in konqueror (kde 3.5) ?

    Matthias Pospiech, Jan 11, 2006, in forum: HTML
    Replies:
    0
    Views:
    405
    Matthias Pospiech
    Jan 11, 2006
  5. IUnknown
    Replies:
    5
    Views:
    777
    Juan T. Llibre
    Jun 3, 2008
Loading...

Share This Page