Bash alias/function to run Zammad doesn't return to bash prompt

Infos:

  • Used Zammad version: 2.0.0
  • Used Zammad installation source: source
  • Operating system: Debian x86

Running the concatenated commands directly in bash prompt to run the Ruby server and startup scripts is pretty straightforward.

However I wanted to simplify the process of running Zammad for my less experienced in Linux colleague, and wrapped the run command(s) into alias. It does run the software but doesn’t return to to bash.

After some research I found the only related SO question, but unfortunately the top-voted answers didn’t help either.

Expected behavior:

Bash alias/function ‘zammad’ runs Zammad, outputs background jobs IDs and returns to bash prompt:

zammad@helpdesk:~$ zammad
[1] 3321
[2] 3322
[3] 3323
zammad@helpdesk:~$

Actual behavior:

Bash alias/function ‘zammad’ runs Zammad, produces no output, moves cursor to the new line, allowing user input:

zammad@helpdesk:~$ zammad

It stays in this state indefinitely, until ^C^C or ^Z is sent to the stdin.

Steps to reproduce the behavior:

  • Add either alias or function named ‘zammad’ to .bashrc:
alias zammad='bundle exec rails s -p 3000 &>> log/zammad.log & bundle exec script/websocket-server.rb start &>> log/zammad.log & bundle exec script/scheduler.rb start &>> log/zammad.log &'
function zammad() {
  bundle exec rails s -p 3000 &>> log/zammad.log &
  bundle exec script/websocket-server.rb start &>> log/zammad.log &
  bundle exec script/scheduler.rb start &>> log/zammad.log &
}
  • Initialize alias/function by executing source .bashrc
  • Run the alias/function

I cannot figure out why wrapping the exact same command(s) into alias or function changes the behavior so much. Please advise.

Personally I wouldn’t do that to be honest.
May I ask what your destination is?

Because your colleague should also check if Zammad is still running beforehand.
Maybe a script like “check-zammad” would be a better idea.

Sometimes there’s power outage in the server room and I might be not available… So I just wanted to give him a single word command that would restore the helpdesk operation

This doesn’t look like a proper way to run any kind of web application. I’d suggest you use a supervisor like systemd or something similar to start the Zammad processes, and then the supervisor will ensure that those process are started when the server boots.

1 Like

The run command is from the official docs, I just added “bundle exec” to make it run in the context of the current bundle.

I’m waiting for the new server/hw so I can finally update to the latest Zammad version and switch from Apache to nginx – will set up the proper startup routine then. Thank you for the suggestion!

The zammad repo apparently already contains systemd scripts: https://github.com/zammad/zammad/tree/master/script/systemd

The documentation explains how to set these up: https://docs.zammad.org/en/latest/install-source.html#starting-servers-with-systemd

Seems very simple, but I haven’t tested it actually though because I prefer docker over the installation from source :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.