TW on node.js without keeping the terminal open

I use my TW on node.js. I am using Linux.

So, I start a terminal.Issue,

tiddlywiki ~/TW --listen port=8090

and leave it running. Adding an & at the end does not help. If I close the terminal, I can not access TW.

Is there a way to access TW without keeping terminal open?

I did just test it with & at the end and it works as expected. It’s an OS option and not TW

@pmario 's trick puts the command in the background, thus allowing you to issue other commands in the same terminal window.

In order to completely detach the command from the terminal, you should prefix it with nohup.

You may also want to redirect the standard output to a log file. In order to do that, you could suffix it with >logfile.

Of course on windows its not the same, although the Linux may Allow this now.

What I do on windows is create a shortcut to the command to launch, and set that to minimised, including when scheduled to load.

@xcazin Thanks. So, I tried:

nohup tiddlywiki ~/TW --listen port=8090

This, too, stopped working as I got out of terminal.

I am running Gnome 40.4 and Gnome Terminal 3.40.

Any idea how to solve this?

Also, if I have to stop and restart TW, how can I do it without the terminal?

From memory you need to add the & or something at the end so the command remains active and returns you to the console session.

Try that then close the terminal window (I say as a windows tragic so not sure)

Sorry, the full command should be:
nohup tiddlywiki ~/TW --listen port=8090 2>&1 >mylogfile &

  • The & at the end puts the command in the background
  • The nohup at the start detaches the command from the terminal
  • The 2>&1 >mylogfile redirects both the standard error and the standard output to a file.

Once you leave the terminal, the process continues to live until you kill it or it crashes by itself, the latter being very rare nowadays with modern node and tiddlywiki :slight_smile: So if you need to kill it, you should rather look for its process id, for instance with the command ps auxww |grep tiddlywiki and then issue a kill <that_id>. Or more directly kill $(pgrep -f "tiddlywiki"), although this one would kill all tiddlywiki processes…

You may want to learn how to embed these commands in scripts, so that this horrid shell syntax gets hidden :wink:

@xcazin Thanks. That was useful. Just one more point. Like there is a way to launch TW in a way we want by putting additional flags, etc. is not there a way to stop/ restart TW? Do we have to depend on the commands of the OS?

Since modifying tiddlers generally results into modifying .tid files on the filesystem (under ~/TW/tiddlers/ in your case) —as well as modifying the standard output by the way—, it is indeed possible to write a shell script that loops over this directory to check whether some files meet some conditions, in which case it would kill the wiki process. I must say that I never felt the need to go that route.

Otherwise, the Bob implementation has some provisions for starting and stopping nodejs wikis from the user interface, and that is an approach that you may want to investigate.