[solved] Unable to restart a service via scheduled jobs / Inappropriate ioctl for device

  • In the past I had issues with the FTP service, obviously a problem nobody could figure out. I did find a workaround, though - but now that doesn't work anymore.
    I'm trying to restart a service - namely proftpd - via scheduled jobs once a day. The way I have tried to do so is via a direct command or by executing a shell script. When running the job manually, both ways work perfectly fine, but when triggered at the specified time, both will fail, the error message reads:

    Code
    mesg: ttyname failed: Inappropriate ioctl for device


    Here's the command:


    And here's the call for the script:



    The script itself is very simple, here are it's entire contents:

    Bash
    #!/bin/sh
    service proftpd restart


    I have searched around for "Inappropriate ioctl for device" with several hits, but I just can't figure out, how to solve the issue here. As said, when I execute either option manually on the scheduled jobs page, they work absolutely fine, ftp will immediately restart.

    • Offizieller Beitrag

    I never run commands directly in cron jobs. And I assume OMV use cron behind the curtains. Instead I run commands from scripts, something like this:


    cd folder_where_the_command_should_run && /bin/bash /full/path/and/name/of/script.sh


    It seems that otherwise the environment can be different from when you run a command manually. Usually it doesn't matter, but sometimes it does... This way the script runs exactly(?) the same as if launched from the command line.


    I add cron jobs by adding lines to /etc/crontab

    Be smart - be lazy. Clone your rootfs.
    OMV 5: 9 x Odroid HC2 + 1 x Odroid HC1 + 1 x Raspberry Pi 4

    Einmal editiert, zuletzt von Adoby ()

  • Thanks - but isn't that exactly what I did with my second option of running a script?
    Or should I change some of the syntax?
    Again, when executed manually in OMV, it does work...

  • Have you tried using this for the command in the scheduled job?


    /usr/sbin/service proftpd restart

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB ECC RAM.

  • Have you tried using this for the command in the scheduled job?


    /usr/sbin/service proftpd restart

    I did not but just have done so.
    Unfortunately, the same result as with the other two solutions - manual execution works like a charm, but when triggered by the set time, the same error "mesg: ttyname failed: Inappropriate ioctl for device" was sent to me by e-mail.

  • I know I have read that thread before - and thought the problem didn't apply to me, because "it simply creates an annoying output, nothing more." which was not true in my case - since the service didn't restart.
    It seems I never tried to edit /root/.profile as suggested, but now did after your suggestion... and it seems to work. I didn't receive any error message by e-mail and I can see in the logs proftp did indeed restart.
    Hooray! Thanks a lot!!

  • Glad I could help. You might want to edit the Subject of the first post to indicate [SOLVED] and change the status to Resolved.

    --
    Google is your friend and Bob's your uncle!


    OMV AMD64 7.x on headless Chenbro NR12000 1U 1x 8m Quad Core E3-1220 3.1GHz 32GB ECC RAM.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!