bash script fails after git update (node.js on linux)

84 views
Skip to first unread message

Rich

unread,
Jan 31, 2019, 3:15:50 AM1/31/19
to TiddlyWiki
Tiddlywiki  5.1.20 prerelease on nodjs on manjaro linux

I have a little bash script that runs on starting the system or that I manually run to reload TW after updates and such.  The script has worked fine to this point, and if I run it from the command line it still works, but when I launch it from its desktop file without going to a terminal it refuses to start. Although it shows up in the system monitor, the browser won't load the page, indicating that the node server did not actually start serving anything.

Here is the refiddle script:

 #! /bin/bash
#restart TiddlyWIki node.js server after updates
killall node
tiddlywiki /home/rich/Dropbox/FiddlyWiki --server $:/core/save/lazy-all

I can't use the newer --listen directive in place of server bacause it does not recognize the lazy loading param at the end while --server still does.
If I run from command line or alt-f2 with full path it runs fine, but it fails to run when launched from the .desktop file below.  I only updated TW, not the script or desktop file, both of which worked fine before the update as far as I can tell.

.desktop launcher:
#!/usr/bin/env xdg-open
[Desktop Entry]
Encoding=UTF-8
Name=refiddle
Categories=Acessories
Exec=/home/rich/bin/refiddle
Icon=/usr/share/icons/HighContrast/scalable/actions/view-refresh.svg
StartupNotify=false
Terminal=false
Type=Application
Comment=Restart FiddlyWiki

I tried a few things but am basically stumped as to why it is failing.  ANyone have any ideas?

Jeremy Ruston

unread,
Jan 31, 2019, 4:21:52 AM1/31/19
to tiddl...@googlegroups.com
Hi Rich


Tiddlywiki  5.1.20 prerelease on nodjs on manjaro linux

I have a little bash script that runs on starting the system or that I manually run to reload TW after updates and such.  The script has worked fine to this point, and if I run it from the command line it still works, but when I launch it from its desktop file without going to a terminal it refuses to start. Although it shows up in the system monitor, the browser won't load the page, indicating that the node server did not actually start serving anything.

Here is the refiddle script:

 #! /bin/bash
#restart TiddlyWIki node.js server after updates
killall node
tiddlywiki /home/rich/Dropbox/FiddlyWiki --server $:/core/save/lazy-all

I can't use the newer --listen directive in place of server bacause it does not recognize the lazy loading param at the end while --server still does.

The listen command uses a new named parameter format (see https://tiddlywiki.com/#NamedCommandParameters), so the equivalent to that server command would be:

--listen root-tiddler=$:/core/save/lazy-all

If I run from command line or alt-f2 with full path it runs fine, but it fails to run when launched from the .desktop file below.  I only updated TW, not the script or desktop file, both of which worked fine before the update as far as I can tell.

.desktop launcher:
#!/usr/bin/env xdg-open
[Desktop Entry]
Encoding=UTF-8
Name=refiddle
Categories=Acessories
Exec=/home/rich/bin/refiddle
Icon=/usr/share/icons/HighContrast/scalable/actions/view-refresh.svg
StartupNotify=false
Terminal=false
Type=Application
Comment=Restart FiddlyWiki

I tried a few things but am basically stumped as to why it is failing.  ANyone have any ideas?

If you can see the stdout generated by apps run by fiddle, It might be worth adding the "--verbose” command to your TW command line.

Best wishes

Jeremy



--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/c67758e7-d7bf-43bb-9d09-9222c4993b8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jwd

unread,
Jan 31, 2019, 10:19:26 PM1/31/19
to TiddlyWiki
It is bash and so $ generally introduces a variable substitution. You might have some luck with making sure that the --server parameter is not being interpreted in some odd way by quoting it:

tiddlywiki /home/rich/Dropbox/FiddlyWiki --server '$:/core/save/lazy-all'

Your shebang line does not look quite right either:
 #! /bin/bash
should be without spaces:
#!/bin/bash
or
#!/usr/bin/env bash

I am guessing the incorrect shebang line might be causing the desktop launcher's Exec directive to fail or use sh (though it would not explain why the process shows up in the system monitor.)

killall node is a bit of a blunt instrument. On some flavors of Linux you might find pkill -f tiddlywiki would be sure that the correct process running node is being killed successfully.

Last, the bare tiddlywiki command - one presumes tiddlywiki is in the PATH that ,xdg-open gives to the process running the refiddle shell script and that the location of the correct version of node is in the environment that tiddlywiki's shebang line is going to get. Setting your path expectations in the refiddle script
export PATH=/where/tiddlywiki/is:/where/node/is:${PATH}
might address mysterious behavior. Again, I am mystified why the node process would continue to show up in the process list.

Those are all the ideas that occur to me.

Rich

unread,
Feb 10, 2019, 7:37:15 AM2/10/19
to TiddlyWiki
Thanks Jeremy and JWD.  I got busy with other things but will see if I can sort this out today.  My guess is that I accidentally put the space in the shebang line, which would explain why the launcher failed but the command line worked.  WIll try out all the other good suggestions too.  Thanks as always!

Rich

unread,
Feb 13, 2019, 8:44:07 PM2/13/19
to TiddlyWiki
These suggestions fixed everything. The only scary thing was that my tiddlers took about 15 seconds to show their content.  SHould I file an issue or is thisan expected part of "laziness?" Thnx again!
Reply all
Reply to author
Forward
0 new messages