Welcome to WebmasterWorld Guest from 54.205.60.49

Forum Moderators: bakedjake

Message Too Old, No Replies

Linux Mint terminal problem

cannot send program to background

   
7:13 pm on Jul 28, 2013 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



I am trying to keep a program running in the background after closing the terminal window that opened it. Specifically the command I'm trying to get is one to schedule the Remind program (a less "hungry" version of KAlarm). The recommended command is:

remind -z0 -k'gxmessage -title "reminder" %s &' ~/.reminders &

but a more simple example also fails...

pluma &

On closing the terminal the invoked program also closes.

The basic requirement is to start Remind and leave it running in the background so that it will automatically check and report reminders. This it does fine until I close the terminal window.

Any ideas, please? Is this a mint-only failing (presumably bash)? I've found a lot of sites saying "use &" or screen, disown, nohup etc but none of these work. I've also tried running commands using sudo but same result.

Ultimately I will need to start the Remind daemon at startup but I want to test it properly first.

(yes, I know I mis-spelled linux in the title - if a mod could oblige, please?)
6:11 am on Jul 29, 2013 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



I am pretty sure & only puts the command in the background - it does not detach it (so it closes when the terminal window closes)

I do not understand who disown and nohup do not work. Have you looked at the nohup.out file it should create?

You can also try putting brackets around the command like so

(pluma &)

It works for me, but I use zsh so I am not sure if it works on bash as well.
11:08 am on Jul 29, 2013 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



That example should be:


(pluma &)
7:42 pm on Jul 29, 2013 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



Just tried the parentheses version - that seems to work. Thanks! Hadn't come across that one before. I'll try it out on remind when I next have a spare moment. :)

I take your point about only putting it in the background but at least some of the sites I've viewed say it retains the app when terminal is closed. From my own experience I'd say they are wrong. :)
10:17 am on Jul 30, 2013 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



They are wrong - otherwise we would not need disown etc. I have tried it on multiple distros.
8:12 pm on Jul 30, 2013 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



As noted above, pluma works correctly in parentheses. Remind does not. At least, the syntax...

(remind -z0 -k'gxmessage -title "reminder" %s &' ~/.reminders &)

fails, as do a couple of variations on the poisition of the closing parenthesis. Putting the & after the parenthesis closes the app when the terminal is closed. Without the & the same applies, as is expected.

disown in front of the remind command with parentheses returns syntax error, without it returns "no such job" for several parts of the command. Removing the trailing & makes no difference.

nohup declares it is ignoring input and the output will be sent to nohup.out (which was last created/updated several days ago and not since). Still no sign of remind in System Monitor.

I've also tried removing the first & but that makes no different to remind remaining open when terminal is closed.

Obviously remind works for some people but I can't get it working without leaving terminal open. :(
6:02 am on Aug 1, 2013 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



Looks like a remind issue. I suggest you try the remind mailing list.

Do you mean it does not show in the system monitor, or that it disappears when you close the terminal?
8:24 pm on Aug 1, 2013 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



When I close terminal remind drops out entirely from the System Monitor tasks list.

I've finally tracked down the mailing list - couldn't find it before. I'll work through it but I have the feeling I'm going to have to use kalarm after all. Which is a nuisance now it uses the otherwise-unecessary akonadai (sp?).
7:59 pm on Aug 8, 2013 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



I could not get remind to stay loaded using the (often) given syntax or any reasonable variation on it including nohup etc. Maybe it's something I've misunderstood or there is a problem in mint; I don't know.

I've tried two python-based alarm/reminder apps but the version of python used by mint maya has a memory allocation problem which steadily uses up swap space (by wasting memory) until there is none left - this is well documented online. On my machine, running at zero bytes swap more or less hangs the machine as it tries (and fails) to swap memory in/out.

My stop-gap solution is to install a reminder plug-in in tomboy. A bit clumsy in use but it does not waste resources unnecessarily as kalarm does.

So: I'd still kile to use remind but cannot get it to stay loaded without keeping the invoking terminal open as well. If anyone who knows how to get this working finds this thread, please post your solution! :)
6:52 pm on Aug 12, 2013 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



Yet another posting... :(

tomboy failed to pop up reminders on a daily (timed) basis so that's another binned app. Back to remind with a permanently open terminal for now and back to looking into keepint the app open when the terminal is closed.

A terrible plague on the kalarm designers for mucking it up! :(
4:49 am on Aug 16, 2013 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



Have you tried -z instead of -z0 ?

Also, are you using a GUI front end to remind? wxRemind starts the remind daemon itself, and I think tkRemind does the same.
9:16 pm on Aug 16, 2013 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



I've used all kinds of switches including a variety of -z times but closing the terminal window still closes the task. :(

I'm using tkremind - I've read that it starts the daemon but (in my case) it lies. Never believe a demon! :)

There was a reason I didn't use wmremind but can't recall why. I might try that.

It's possible that remind stays loaded if I do not include the gxmessage target - I did test this and I seem to recall it fails, though; and there is no point because I need the popup.

I'm (very!) slowly working my way through the bash man but it takes a bit of deciphering (for me, at least) and I'm still struggling.
9:14 pm on Sep 16, 2013 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



Tackling this again...

It's occurred to me to wonder: the terminal on these machines here is mate-terminal but in several places in one or more conf tools there is mention of gnome-terminal. I wonder if there is a difference that prevents mate-terminal retaining the task. Although probably not: one site I found that compares terminal apps said they are the same.

There is a recommendation somewhere to include the string ...

remind -z0 -k'gxmessage -title "reminder" %s' ~/.reminders &

... in ~/.xinitrc so that it's set up at boot but that didn't work.
4:33 am on Sep 17, 2013 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month



I do not believe its a difference in terminal apps: not if they are both running the same shell.

Have you tried asking on the Linux Mint forums?
7:33 pm on Sep 17, 2013 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



Not yet. I'm always wary of joining forums and even more so since the ubuntu forums break-in. :(

I do search the mint and ubuntu forums but I'm going to have to join and post soon. :(
4:56 pm on Sep 23, 2013 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



An update on this. So far I have the following working:

tkremind icon on panel

click/launch tkremind

Set tkremind Options to "feed popped-up reminder to command's standard input" (no idea why/which command but seems to work).

run in terminal: (remind -z0 ~/.reminders) &
(assumes remind/tkremind data file .reminders is in home folder)

close terminal: remind stays in task list (ie running)

As long as tkremind is open the reminders trigger a popup display (no idea what app displays it but a small, plain-clothes, silver job). If I close tkremind, remind drops out of the task list and (as expected) no popups.

If I launch tkremind again the task is automatically added to the task list again; any near-recent reminders cause a popup. Close tkremind and all gone again.

It looks as if I need to have tkremind on the "open apps" task bar, otherwise the remind task fails. Which is a bit of a nuisance.

When I have a moment I'll ask in the remind forum, possibly the mint forum. I suspect the above is going to be as good as it gets, though.

Shame about kalarm. :(
9:00 pm on Oct 22, 2013 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



An allied problem solved (I think)...

I tried to run vino-server on a new machine (see below).

1. install vino server (and vinagre client)

2. In Terminal: vino-preferences (allow sharing/control then close)

3. In Terminal: /usr/lib/vino/vino-server --sm-disable &
(the & added for this but may be unnecessary)
ignore unknown children warning and type exit to close terminal
(on other installations I just hit Ctrl-Z)
This closed the terminal and left vino-server in the Tasks list (System Monitor).
If I used Ctrl-Z and then closed the terminal, vino-server dropped out of the task list (ie closed) as remind did.

4. Add command...
/usr/lib/vino/vino-server --sm-disable
...to Startup Applications Prefs as new item. This worked on two other machines (including this one pre-disk replacement) but failed on a reboot this time around (may need trailing & - not tried yet but didn't need it on other installations).

This is a new installation on an old machine (the one discussed earlier in this thread: the hard disk died of segments so a sort-of complete installation. Sort-of because I backed up and restored the package list using...

dpkg --get-selections > /backup/installed-software.log

...to backup the list and (as superuser)...

dpkg --set-selections < /backup/installed-software.log
(commands are for mint - others vary)

I subsequently restored various stuff from the nightly backup, mostly from the home folders.

I mention this because the failure to behave the same as other machines when running the vino-server commands may have been a left-over from the previous installation as partially reinstalled and as applied to remind (remember this machine worked fine with vino-server installation before rebuild AND before remind experiments).

I have not yet had time to try the remind program on this "new" machine.