Solved! Re: crontab not executing as regular user

Antonio Olivares olivares14031 at gmail.com
Tue May 2 18:20:10 PDT 2017


I checked the /tmp/ directory, there were .X0-lock, X1-lock, ...,
X13-lock.  I became superuser, removed these and now $DISPLAY is :0 and all
works well :)

The xterm window depends on the $DISPLAY variable, and because of this I
was getting errors.  Thanks to all who have helped me fix this issue.

Best Regards,


Antonio

On Sunday, April 30, 2017, Lanir <lanir at cisns.net> wrote:

> If it's just the video output that's the problem try checking out this
> flag:
>
> mplayer -vo null
>
> Used this way it will not try to output any video at all and hopefully
> skip the check for a display. If you only want the audio, this may keep you
> from having a repeat issue later if your setup changes or you're not logged
> in when it runs.
>
>
>
>
> On 04/30/2017 07:05 PM, Antonio Olivares wrote:
>
>
>
> On Sunday, April 30, 2017, Dylan Reinhold <dylan at ocnetworking.com
> <javascript:_e(%7B%7D,'cvml','dylan at ocnetworking.com');>> wrote:
>
>> mplayer expects to have an x window running.
>> You could try in your script to default to to the first one with
>> export DISPLAY=:0
>>
>> Not sure this will work when you are not logged in, but could be a start.
>>
>> Dylan
>>
>> On Sun, Apr 30, 2017 at 4:46 PM, Antonio Olivares <
>> olivares14031 at gmail.com> wrote:
>>
>>>
>>>
>>> On Sunday, April 30, 2017, Dylan Reinhold <dylan at ocnetworking.com>
>>> wrote:
>>>
>>>> Does the command .dalarm exist in the users home directory (and not
>>>> just roots home)?
>>>> Can you run ~/.dalarm from the commandline as that user?
>>>>
>>>> If it does, change your redirections from /dev/null into a file so you
>>>> can see the errors
>>>> 30 16 * * * ~/.dalarm >>~/dalarm.log 2>&1
>>>>
>>>> Then look in the log for any errors.
>>>>
>>>> Dylan
>>>>
>>>> On Sun, Apr 30, 2017 at 4:05 PM, Antonio Olivares <
>>>> olivares14031 at gmail.com> wrote:
>>>>
>>>>> Dear folks,
>>>>>
>>>>> I am having a difficult time getting cron to run a script.  I ran
>>>>> $ crontab -e
>>>>>
>>>>> Added the commands
>>>>> # min hr mon dom dow command
>>>>> 30 16 * * * ~/.dalarm >/dev/null 2>&1
>>>>>
>>>>> Where ~/.dalarm has a command to call mplayer and play some music
>>>>> files.
>>>>> #!/bin/sh
>>>>>
>>>>> /usr/local/bin/mplayer -really-quiet -shuffle -playlist ~/.playlist
>>>>>
>>>>> I have setup a crontab for root user and it is working there, but not
>>>>> as regular user.  I have checked and there is no /var/cron/deny for my
>>>>> user. I have read that I need to specify $PATH in crontab file as well in
>>>>> documentation.  Any ideas as to how to fix this?
>>>>>
>>>>> Best Regards,
>>>>>
>>>>>
>>>>> Antonio
>>>>>
>>>>
>>>> The error is as follows
>>> /usr/local/bin/xterm:  Xt error:  Can't open display:
>>> /usr/local/bin/xterm:  DISPLAY is not set
>>>
>>> Best Regards,
>>>
>>>
>>> Antonio
>>>
>>
>> I am trying it out to see if it would work or not.  I had another xterm
> shell opened, so maybe that is why it did not work?
> I tried it and it still fails :(
> I have checked
> $ echo $DISPLAY
> and it outputs :13
>
> I have changed it to :13 and now it works!  Thank you very much for your
> help.
>
> Best Regards,
>
>
> Antonio
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20170502/9c602aca/attachment-0002.htm>


More information about the Users mailing list