Breaking behaviour in scripts

Patrick McAndrew's Avatar

Patrick McAndrew

30 Sep, 2015 07:23 PM

#!/bin/bash
echo "(this used to work)"

now I have to escape the () when saving scripts (not that I'm notified, rather, the script errors when run)

  1. Support Staff 1 Posted by Igor Savchenko on 30 Sep, 2015 07:33 PM

    Igor Savchenko's Avatar

    Can you please provide /var/log/scalarizr_debug.log from the server where such script failed to run.

    Thanks,
    Igor

  2. 2 Posted by Patrick McAndre... on 30 Sep, 2015 07:45 PM

    Patrick McAndrew's Avatar

    2015-09-30 19:29:04,274+00:00 - DEBUG - scalarizr.messaging.p2p.consumer - Received message 'ExecScript' (message_id: 006e14d0-b88c-4436-b669-5c4c43495a47, format: json)
    2015-09-30 19:29:04,324+00:00 - DEBUG - scalarizr.messaging.p2p.store - Commiting put_ingoing
    2015-09-30 19:29:04,324+00:00 - DEBUG - scalarizr.messaging.p2p.store - Commited put_ingoing
    2015-09-30 19:29:04,331+00:00 - DEBUG - scalarizr.messaging.p2p.consumer - Notify message listeners (message_id: 006e14d0-b88c-4436-b669-5c4c43495a47)
    2015-09-30 19:29:04,331+00:00 - DEBUG - scalarizr.handlers - Handle 'ExecScript'
    2015-09-30 19:29:04,332+00:00 - DEBUG - scalarizr.handlers - Scalr version: (5, 10, 1)
    2015-09-30 19:29:04,342+00:00 - DEBUG - scalarizr.messaging.p2p.consumer - "POST /control HTTP/1.1" 201 -
    2015-09-30 19:29:04,342+00:00 - DEBUG - scalarizr.handlers - Call handler ScriptExecutor
    2015-09-30 19:29:04,343+00:00 - DEBUG - scalarizr.handlers.script_executor - Scalr notified me that 'Manual' fired
    2015-09-30 19:29:04,343+00:00 - DEBUG - scalarizr.handlers.script_executor - Fetching scripts from incoming message
    2015-09-30 19:29:04,343+00:00 - DEBUG - scalarizr.handlers.script_executor - Fetched 1 scripts
    2015-09-30 19:29:04,343+00:00 - INFO - scalarizr.handlers - Executing 1 Manual script(s)
    2015-09-30 19:29:04,353+00:00 - DEBUG - scalarizr.messaging.p2p.consumer - Mark message (message_id: 006e14d0-b88c-4436-b669-5c4c43495a47) as handled
    2015-09-30 19:29:04,355+00:00 - DEBUG - scalarizr.handlers.script_executor.1443641344.48 - Executing /bin/bash
      /usr/local/bin/scalr-scripting.1443641344.48/Cron_SWeb_PM_Dep_DynamoDb_Page_Analytics
      1>/var/log/scalarizr/scripting/Cron_SWeb_PM_Dep_DynamoDb_Page_Analytics.Manual.77e21330-1f59-40b9-8754-f896a6979422-out.log
      2>/var/log/scalarizr/scripting/Cron_SWeb_PM_Dep_DynamoDb_Page_Analytics.Manual.77e21330-1f59-40b9-8754-f896a6979422-err.log
      timeout: 600 seconds
    2015-09-30 19:29:04,415+00:00 - DEBUG - scalarizr.handlers.script_executor.1443641344.48 - Communicating with /bin/bash (pid: 3025)
    2015-09-30 19:29:09,421+00:00 - DEBUG - scalarizr.handlers.script_executor.1443641344.48 - Process terminated
    2015-09-30 19:29:09,423+00:00 - DEBUG - scalarizr.handlers.script_executor.1443641344.48 - Finished /bin/bash
      /usr/local/bin/scalr-scripting.1443641344.48/Cron_SWeb_PM_Dep_DynamoDb_Page_Analytics
      1: 0.00B
      2: 143.00B
      return code: 2
      elapsed time: 5.00801610947
    2015-09-30 19:29:09,424+00:00 - DEBUG - scalarizr.handlers.script_executor - sending exec script result message
    2015-09-30 19:29:09,425+00:00 - DEBUG - scalarizr.messaging.p2p.producer - Sending message 'ExecScriptResult' into queue 'log'
    2015-09-30 19:29:09,436+00:00 - DEBUG - scalarizr.messaging.p2p.producer - Delivering message 'ExecScriptResult' {'event_server_id': u'73d6d7c6-1548-43fd-a909-86f2ed53472c', 'event_id': None, 'stdout': '\n', 'return_code': 2, 'script_name': u'Cron_SWeb_PM_Dep_DynamoDb_Page_Analytics', 'run_as': None, 'time_elapsed': 5.008016109466553, 'stderr': 'L3Vzci9sb2NhbC9iaW4vc2NhbHItc2NyaXB0aW5nLjE0NDM2NDEzNDQuNDgvQ3Jvbl9TV2ViX1BNX0RlcF9EeW5hbW9EYl9QYWdlX0FuYWx5dGljczogbGluZSAxNDE6IHVuZXhwZWN0ZWQgRU9GIHdoaWxlIGxvb2tpbmcgZm9yIG1hdGNoaW5nIGAiJwo=\n', 'script_path': u'/usr/local/bin/scalr-scripting.1443641344.48/Cron_SWeb_PM_Dep_DynamoDb_Page_Analytics', 'event_name': u'Manual', 'execution_id': u'77e21330-1f59-40b9-8754-f896a6979422'}. Json: True, Headers: {'Content-Type': 'application/json'}
    2015-09-30 19:29:09,436+00:00 - DEBUG - scalarizr.messaging.p2p.security - Encrypting message
    2015-09-30 19:29:09,644+00:00 - DEBUG - scalarizr.messaging.p2p.producer - Message 'ExecScriptResult' delivered (message_id: e9ed8f8b-0c11-457b-9e17-980e647e1645)

  3. 3 Posted by Patrick McAndre... on 30 Sep, 2015 07:47 PM

    Patrick McAndrew's Avatar

    Note that script logs displays:
     
     line 71: syntax error near unexpected token `('

    This was a script that was working fine, and when I make a small adjustment unrelated to any ( it started complaining

  4. Support Staff 4 Posted by Igor Savchenko on 30 Sep, 2015 07:50 PM

    Igor Savchenko's Avatar

    Our engineers are looking into this.

  5. Support Staff 5 Posted by Igor Savchenko on 30 Sep, 2015 10:02 PM

    Igor Savchenko's Avatar

    Patrick,

    We were not able to reproduce this and code:

    #!/bin/bash
    echo "(this used to work)"

    Works perfectly on our server.

    In the script "Cron_SWeb_PM_Dep_DynamoDb_Page_Analytics" there is missed " what makes this script invalid.

    Regards,
    Igor

  6. Support Staff 6 Posted by Igor Savchenko on 01 Oct, 2015 04:46 PM

    Igor Savchenko's Avatar

    Hi Patrick,

    Our engineers confirmed that there were no changes on our end. And after checking logs they found that you've forgotten to add " to your scripts.

    Do you still need any help here?

    Regards,
    Igor

  7. 7 Posted by Patrick McAndre... on 19 Oct, 2015 04:06 PM

    Patrick McAndrew's Avatar

    Thanks for checking. issue is resolved

  8. Patrick McAndrew closed this discussion on 19 Oct, 2015 04:06 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac