Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I wrote a bash script to check when my password will expire. 5 days before the expiration, I create a file (/tmp/warningPasswd) that contains something like : You password ...
  1. #1
    xuo
    xuo is offline
    Just Joined!
    Join Date
    Oct 2006
    Posts
    29

    How to open a pop-up window using cron.

    Hi,

    I wrote a bash script to check when my password will expire. 5 days before the expiration, I create a file (/tmp/warningPasswd) that contains something like :
    You password will expire in 5 days.
    Everything is managed with the script and cron and works fine.
    But I would like to open a window (a text editor window or a notification window with notify-send for example) which would make it easier for the user to know that his password will expire soon rather than letting him check if the /tmp/warningPasswd file exists or not.
    I did not succeed to make cron open any window. How can I do ?
    I must precise that I can't send any mail as the mail function is de-activated at my work for security reasons.

    Regards.

    Xuo.

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    As you already have mentioned, notify-send is a way to achieve this.
    For example
    Code:
    notify-send 'CRONJOB speaking' 'Hello, this is the cronjob'
    But this only sends the message to the user who has executed the command.
    If the cronjob is executed by root user, you would need to use sudo.
    Debian GNU/Linux -- You know you want it.

  3. #3
    xuo
    xuo is offline
    Just Joined!
    Join Date
    Oct 2006
    Posts
    29
    Hi,

    Thank you for your answer.
    I have the same problem with notify-send, which is an X11 problem (this is what the mail I received from cron was suggesting).
    I modified my crontab this way :
    DISPLAY :0.0
    00 19 * * * /fullPath/myScript.csh

    Doing this, myScript.csh can do something like "$EDITOR /tmp/warningPasswd".
    I don't know if setting this variable in the script itself would do the same.

    Xuo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...