Announcement

Collapse
No announcement yet.

crontab -e only creates temporary files in tmp. it never runs

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    crontab -e only creates temporary files in tmp. it never runs

    Code:
    crontab -e
    pulls up my personal crontab (that I orig created with crontab -e)
    I run SearchMonkey and it finds 3 instances of files named crontab in the following locations:
    1. /tmp/crontab.YeXHKM (this is my crontab)
    2. /etc (this looks like an official crontab)
    3. /usr/bin (open in Kate and it is illegible characters (not a text file))
    back to terminal I exit pico and successfully save changes
    Rerun SearchMonkey and now the /tmp entry is gone.

    So nowhere in this desktop search (recursively going through root folder) does my crontab show up yet if I go back to terminal and try again it pops up again (and /tmp is populated again)).

    entries in personal tab don't run. I also tried adding a line to the /etc file. neither work and I can't find a log file

    here are the two file's content:
    /tmp/crontab.dlkdsjf
    Code:
    55 * * * * root echo "hello"
    /etc
    Code:
    # /etc/crontab: system-wide crontab
    # Unlike any other crontab you don't have to run the `crontab'
    # command to install the new version when you edit this file
    # and files in /etc/cron.d. These files also have username fields,
    # that none of the other crontabs do.
    
    SHELL=/bin/sh
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    
    # m h dom mon dow user	command
    17 *	* * *	root  cd / && run-parts --report /etc/cron.hourly
    25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
    47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
    52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
    55 * * * * root echo "hello"
    #
    confused
    KDE neon LTS 5.12

    #2
    Re: crontab -e only creates temporary files in tmp. it never runs

    CLI

    > CronHowto


    With the KDE (gui)

    Package: kcron
    program scheduler for KDE 4
    KCron is a system settings module for scheduling programs to run at specific
    intervals using cron, the UNIX scheduling service.
    K > System Settings > Advanced > Task Scheduler


    Earlier:
    > Topic: How to create a system cron in Task Scheduler?
    > Topic: kcron confusion - SOLVED


    Crontab location

    /var/spool/cron/crontabs/$USER

    > Intro to cron:
    ...The main config file is normally /etc/crontab...

    Multiuser cron

    ...The crontab file is often stored in /var/spool/cron/crontabs/<user> (Unix/Slackware/*BSD),
    /var/spool/cron/<user> (RedHat) or /var/cron/tabs/<user> (SuSE),
    but might be kept elsewhere depending on what Un*x flavor you're running...

    Code:
    sudo ls -l /var/spool/cron/crontabs/
    -rw------- 1 rog crontab 341 2010-04-08 23:24 rog
    -rw------- 1 root crontab 273 2010-04-02 14:28 root

    Output to the display

    ...
    here are the two file's content:
    /tmp/crontab.dlkdsjf

    55 * * * * root echo "hello"
    ...
    The Cron needs to know to where (display) and with what application (konsole, kdialog, ...)

    Exaple with the kdialog /1/. Adding 5 sec popup (using the KCron):
    Code:
    kdialog --display :0 --passivepopup hello 5
    Crontab is telling
    Code:
    crontab -l
    #No comment
    25 23 8 4 * kdialog --display :0 --passivepopup hello 5


    # File generated by KCron the Thursday 08 April 2010 23:24.
    With the cat:
    Code:
    sudo cat /var/spool/cron/crontabs/rog
    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (/tmp/kde-rog/systemsettingsVY2911.tmp installed on Thu Apr 8 23:24:03 2010)
    # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
    #No comment
    25 23 8 4 * kdialog --display :0 --passivepopup hello 5


    # File generated by KCron the Thursday 08 April 2010 23:24.
    [img width=400 height=104]http://img196.imageshack.us/img196/7662/kdialog.png[/img]


    /1/ kdialog --help
    Usage: kdialog [Qt-options] [KDE-options] [options] [arg]

    KDialog can be used to show nice dialog boxes from shell scripts
    Before you edit, BACKUP !

    Why there are dead links ?
    1. Thread: Please explain how to access old kubuntu forum posts
    2. Thread: Lost Information

    Comment


      #3
      Re: crontab -e only creates temporary files in tmp. it never runs

      Thank you Rog. That was a great reply with lots of info.

      So the only thing wrong was my cron syntax.

      I tested your dialoguebox command and it worked. (I always wanted to create my own notices)

      2 more questions.

      1. I installed kcron. But it did not show up in K Menu and I cannot find it. How do I run it?

      2. I want ktorrent to run every night at 2am. What would the cron line look like for that?
      I've tried
      38 * * * * /usr/bin/ktorrent
      and
      38 * * * * ktorrent

      KDE neon LTS 5.12

      Comment


        #4
        Re: crontab -e only creates temporary files in tmp. it never runs

        I found task scheduler in the System Settings/Advanced

        But even there I could not get it to run ktorrent
        KDE neon LTS 5.12

        Comment


          #5
          Re: crontab -e only creates temporary files in tmp. it never runs

          I found task scheduler in the System Settings/Advanced

          But even there I could not get it to run ktorrent

          Try with the "--display :0"


          Here:
          Code:
          /usr/bin/ktorrent --display :0
          =>

          Code:
          crontab -l
          #No comment
          15 17 * * * /usr/bin/ktorrent --display :0


          # File generated by KCron the Friday 09 April 2010 17:11.
          and

          [img width=400 height=260]http://img519.imageshack.us/img519/1929/ktorrrenttodisplay0.png[/img]

          The Ktorrent was poping up 17.15


          Note !
          If the Ktorrent is closed from the system tray it will open to the system tray.
          Before you edit, BACKUP !

          Why there are dead links ?
          1. Thread: Please explain how to access old kubuntu forum posts
          2. Thread: Lost Information

          Comment


            #6
            Re: crontab -e only creates temporary files in tmp. it never runs

            Hello Rog,

            That did work but terminal also comes up with this message:
            -------------------------------------------------------------------------
            End of script execution. Type Enter or Ctrl+C to exit.
            -------------------------------------------------------------------------

            Can that be prevented?
            More importantly, where can I learn more about this? I googled ktorrent, bash, command line, parameters, terminal, and I could not find a reference to ktorrent's command line parameters anywhere.

            thanks
            KDE neon LTS 5.12

            Comment


              #7
              Re: crontab -e only creates temporary files in tmp. it never runs

              A good place to start is Kubuntu Forums > Important Information > Documentation. There you can find > HOWTO find Kubuntu's manual / reference / guide / documentation / help.

              And if you look closely you can see > The art of using manuals at my "signature".



              Code:
              ktorrent --help-all
              Usage: ktorrent [Qt-options] [KDE-options] [Url]

              Bittorrent client for KDE

              <clip>
              Qt options:
              --display <displayname> Use the X-server display 'displayname'
              <clip>
              Before you edit, BACKUP !

              Why there are dead links ?
              1. Thread: Please explain how to access old kubuntu forum posts
              2. Thread: Lost Information

              Comment


                #8
                Re: crontab -e only creates temporary files in tmp. it never runs

                Thanks again Rog, I read through the art of using manuals and the --help of ktorrent.

                1. When you tested ktorrent with kcron, did the terminal show up like it did for me? (reading through all the help I don't see anything that will stop this.
                2. --help doesn't say anything about ":0" as a parameter. What is this about?
                KDE neon LTS 5.12

                Comment


                  #9
                  Re: crontab -e only creates temporary files in tmp. it never runs

                  1. When you tested ktorrent with kcron, did the terminal show up like it did for me? (reading through all the help I don't see anything that will stop this.
                  I don't have script problems.

                  Are you using scripts ?



                  More > KTorrent wiki


                  2. --help doesn't say anything about ":0" as a parameter. What is this about?
                  The Linux is using the X:

                  Code:
                  man X
                  NAME
                  X - a portable, network-transparent window system

                  SYNOPSIS
                  The X Window System is a network transparent window system which runs on a wide range of computing and graphics machines. It should be relatively straightforward to build the X.Org Foundation software distribution on most ANSI C and POSIX compliant systems. Commercial implementations are also available for a wide range of platforms...


                  DISPLAY NAMES
                  From the user's perspective, every X server has a display name of the form:

                  hostname:displaynumber.screennumber
                  + lot of stuff

                  => :0
                  Before you edit, BACKUP !

                  Why there are dead links ?
                  1. Thread: Please explain how to access old kubuntu forum posts
                  2. Thread: Lost Information

                  Comment


                    #10
                    Re: crontab -e only creates temporary files in tmp. it never runs

                    1.
                    I'm not using any scripts in Ktorrent. (didn't notice that sidebar until you posted)

                    But I have the same 3 items in the Scripts sidebar.

                    I am not using scripts anywhere that I know of.

                    2.
                    Are you saying I will find :0 in the man X text?
                    I tried but couldn't find any mention?
                    What does :0 do?

                    Thanks again!
                    KDE neon LTS 5.12

                    Comment


                      #11
                      Re: crontab -e only creates temporary files in tmp. it never runs

                      Originally posted by finny388
                      2.
                      Are you saying I will find :0 in the man X text?
                      I tried but couldn't find any mention?
                      What does :0 do?

                      Thanks again!
                      Yes, it's in the man X text:
                      DISPLAY NAMES
                      From the user's perspective, every X server has a display name of the form:

                      hostname:displaynumber.screennumber

                      This information is used by the application to determine how it should connect to the
                      server and which screen it should use by default (on displays with multiple monitors):

                      hostname
                      The hostname specifies the name of the machine to which the display is physi‐
                      cally connected. If the hostname is not given, the most efficient way of com‐
                      municating to a server on the same machine will be used.

                      displaynumber
                      The phrase "display" is usually used to refer to collection of monitors that
                      share a common keyboard and pointer (mouse, tablet, etc.). Most workstations
                      tend to only have one keyboard, and therefore, only one display. Larger,
                      multi-user systems, however, frequently have several displays so that more than
                      one person can be doing graphics work at once. To avoid confusion, each dis‐
                      play on a machine is assigned a display number (beginning at 0) when the X
                      server for that display is started. The display number must always be given in
                      a display name.

                      screennumber
                      Some displays share a single keyboard and pointer among two or more monitors.
                      Windows no longer obstructs my view.
                      Using Kubuntu Linux since March 23, 2007.
                      "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                      Comment


                        #12
                        Re: crontab -e only creates temporary files in tmp. it never runs

                        Originally posted by finny388
                        2.
                        Are you saying I will find :0 in the man X text?
                        I tried but couldn't find any mention?
                        What does :0 do?
                        Snowhog already posted the information, but if you're wondering how it all fits together, I'll explain a bit further:

                        <clip>
                        Qt options:
                        --display <displayname> Use the X-server display 'displayname'
                        <clip>
                        As you can see, the '--display' option requires that you give an additional argument, 'displayname'. Because --display allows you to set the $DISPLAY variable for the program, it's natural that you also have to actually set a value for it ('--display' without 'displayname' wouldn't do anything).

                        hostname:displaynumber.screennumber
                        This is the syntax for 'displayname', but hostname and screennumber can be omitted (they default to 'localhost' and '.0'). ':0' is the same as ':0.0', for example, and means the "first screen of the first X session running on this machine"

                        Why do you need these displaynames?
                        You can run programs on multiple hosts (local or remote), a host can have more than one X session running, and every X session can have more than one screen, and the "displayname" allows you to distinguish between them. The $DISPLAY variable tells a graphical program where it should show it's window.

                        Why do you need to define the displayname for cron?
                        Normally (when running an X session) the $DISPLAY variable is set so the programs you start within the session know which display to start on (by default)...you can test this by starting konsole and running "echo $DISPLAY". (of course if you wish to start a program showing it's window on another host, another X session or another screen, you'll need to define displayname accordingly)

                        However, the $DISPLAY variable is usually set only within the X session, and cron (like ttys) does not run within the session (as a system service, it starts and runs independently from X sessions). So if you wish to run graphical programs with cron, you'll need to set the $DISPLAY for the program.

                        Comment


                          #13
                          Re: crontab -e only creates temporary files in tmp. it never runs

                          Nicely explained.
                          Windows no longer obstructs my view.
                          Using Kubuntu Linux since March 23, 2007.
                          "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                          Comment


                            #14
                            Re: crontab -e only creates temporary files in tmp. it never runs

                            Indeed Kubicle, that really helped. Gets me 1 step further in this journey into linux/ubuntu
                            and thank you Snowhog. I guess the man alone didn't give so much context as Kubicle provided

                            you two seem to understand cron quite well. Can you explain why Konsole launches as well as Ktorrent with message:
                            -------------------------------------------------------------------------
                            End of script execution. Type Enter or Ctrl+C to exit.
                            -------------------------------------------------------------------------

                            currently I use KAlarm to launch Ktorrent with the simple command "Ktorrent". Am I right in thinking that since KAlarm runs within the X session it is exempt from needing to specify displayname?

                            I was hoping to dump KAlarm and use cron since cron is already running in the background.
                            It appeared so simple at first but it seems I have a lot to learn about the commands I give it.
                            What language are these commands? unix? linux? ubuntu linux?

                            THANKS AGAIN

                            KDE neon LTS 5.12

                            Comment


                              #15
                              Re: crontab -e only creates temporary files in tmp. it never runs

                              Originally posted by finny388
                              Am I right in thinking that since KAlarm runs within the X session it is exempt from needing to specify displayname?
                              yes

                              Can you explain why Konsole launches as well as Ktorrent with message:
                              -------------------------------------------------------------------------
                              End of script execution. Type Enter or Ctrl+C to exit.
                              -------------------------------------------------------------------------
                              Does this happen only when you start ktorrent via cron?
                              Does this happen with other programs if launched via cron?

                              You could try using this command to launch ktorrent (via cron):
                              Code:
                              /usr/bin/ktorrent --display :0 >> /dev/null 2>&1
                              (this will send all terminal output from ktorrent to "bit heaven" (/dev/null))

                              You can also direct the output to a file to see if there is anything of interest in the output:
                              Code:
                              /usr/bin/ktorrent --display :0 > ~/ktorrent_output.txt 2>&1
                              (this should write output to a file /home/username/ktorrent_output.txt)

                              Another thing you might have a go with is setting the $DISPLAY variable explicitly:
                              Code:
                              env DISPLAY=:0.0 /usr/bin/ktorrent > ~/ktorrent_output.txt 2>&1

                              Comment

                              Working...
                              X