A
A
Alexander Petrov2018-09-28 15:19:41
Ruby on Rails
Alexander Petrov, 2018-09-28 15:19:41

How to escape quotes in cron?

I need to run a certain model on time.
I do it like this:

57 14 * * * bash -l -c 'cd /home/app/project/pervichka/current/ && bundle exec rails runner -e production "Whenever.update_complexes('72,74,76')"' > /dev/null 2>&1

But where the variable is passed, there are quotes that need to be escaped:
Whenever.update_complexes('72,74,76')
I tried to do this:
Whenever.update_complexes(\'72,74,76\')
How to properly escape quotes in cron?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
oh_shi, 2018-09-28
@Mirkom63

57 14 * * * bash -l -c 'cd /home/app/project/pervichka/current/ && bundle exec rails runner -e production '\''Whenever.update_complexes("72,74,76")'\''' > /dev/null 2>&1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question