{"id":759,"date":"2020-12-01T16:08:00","date_gmt":"2020-12-01T15:08:00","guid":{"rendered":"https:\/\/support.websupport.se\/?post_type=ht_kb&p=759"},"modified":"2021-12-20T11:24:09","modified_gmt":"2021-12-20T10:24:09","slug":"cron-jobb","status":"publish","type":"ht_kb","link":"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/","title":{"rendered":"CRON-jobb"},"content":{"rendered":"N\u00e1vod pre mierne pokro\u010dil\u00fdch<\/span>\n\n\n\n

Cron \u00e4r ett program som k\u00f6rs p\u00e5 v\u00e5ra servrar som du kan st\u00e4lla in vad och n\u00e4r du ska k\u00f6ras. Du kan anv\u00e4nda det till exempel n\u00e4r du uppdaterar databasen, g\u00f6r regelbundna s\u00e4kerhetskopior, nedladdning av information fr\u00e5n Internet etc.<\/p>\n\n\n\n


\n\n\n\n

CRON-jobb <\/strong>\u00e4r mycket anv\u00e4ndbara f\u00f6r att automatisera repetitiva uppgifter. Med deras hj\u00e4lp kan du till exempel k\u00f6ra ett skript en g\u00e5ng i veckan f\u00f6r att ta bort tillf\u00e4lliga filer f\u00f6r att undvika att fylla i utrymme. Vissa program, som Drupal, kr\u00e4ver till och med att CRON-uppgifter skapas f\u00f6r att fungera korrekt. S\u00e5ledes anv\u00e4nds Cron f\u00f6r att k\u00f6ra skriptet igen vid en viss tidpunkt. Det \u00e4r m\u00f6jligt att st\u00e4lla in flera typer av crons p\u00e5 v\u00e5ra servrar, som kommer att k\u00f6ras. Du kan konfigurera Cron via v\u00e5rt Webadmin-gr\u00e4nssnitt
<\/p>\n\n\n\n

Installation<\/h2>\n\n\n\n
  1. Logga in p\u00e5 https:\/\/admin.websupport.se <\/a> <\/li>
  2. V\u00e4lj den dom\u00e4n f\u00f6r vilken du vill st\u00e4lla in Cron i avsnittet Tj\u00e4nster<\/li>
  3. I menyn till v\u00e4nster klickar du p\u00e5 Cron-jobb, sedan uppe till h\u00f6ger \u00e4r den bl\u00e5 knappen Skapa en ny CRON-uppgift<\/li><\/ol>\n\n\n\n

    <\/p>\n\n\n\n

    \"\"<\/figure>\n\n\n\n
    \n\n\n\n

    Beskrivning av parametrar (WGET) f\u00f6r Cron<\/h2>\n\n\n\n

    1. Cron-typ<\/strong>
    <\/h4>\n\n\n\n

    Du kan k\u00f6ra Cron-jobb antingen som ett php-skript, som finns direkt p\u00e5 din v\u00e4rd eller som vilken webbadress som helst.<\/p>\n\n\n\n

    • Vid http-rad anger vi t.ex. https:\/\/dom\u00e4n.se\/scripts\/cron.php?variabel=varde<\/li>
    • i fallet med ett php-skript, g\u00e5r vi in \u200b\u200bmed en relativ s\u00f6kv\u00e4g till dom\u00e4nen (web \/ scipts \/ cron.php), en mer detaljerad beskrivning i andra delen av handboken<\/li><\/ul>\n\n\n\n

      2. Upprepa<\/strong><\/h4>\n\n\n\n

      Cron inneh\u00e5ller specifik syntax f\u00f6r att skapa tiden n\u00e4r den ska k\u00f6ras. Den anges i standard crontab Unix-format [minuter] [timmar] [dag i m\u00e5naden] [m\u00e5nad] [veckodag]. Anv\u00e4nd f\u00f6ljande sida f\u00f6r att enkelt skapa \u00f6nskad starttid: https:\/\/www.openjs.com\/scripts\/jslibrary\/demos\/crontab.php<\/p>\n\n\n\n

      Demonstrationer av tid i avancerade inst\u00e4llningar<\/strong><\/p>\n\n\n\n

      varje minut\n* * * * *\n\nvar 5: e minut\n\/ 5 * * * *\nvarje timme, i den 30: e minuten\n30 * * * *\n\nvarje dag vid midnatt\n0 0 * * *\n\np\u00e5 s\u00f6ndag kl 12:00\n0 12 * * 0 eller\n0 12 * * 7\n\np\u00e5 vardagar klockan 12:00 utom helger\n0 12 * * 1,2,3,4,5<\/pre>\n\n\n\n

      Till\u00e5tna v\u00e4rden f\u00f6r tiden<\/strong><\/p>\n\n\n\n

      • Minuter: 0-59<\/li>
      • Timmar: 0-23<\/li>
      • M\u00e5nadens dag: 1-31<\/li>
      • M\u00e5nad: 1-12<\/li>
      • Veckodag: 0-7 (0 och 7 \u00e4r s\u00f6ndagar)<\/li><\/ul>\n\n\n\n

        3. Skripts\u00f6kv\u00e4g eller http-l\u00e4nk<\/strong>
        <\/h4>\n\n\n\n

        Ange webbadressen som du vill g\u00f6ra en vanlig fr\u00e5ga med CRON. Ange adressen i ett formul\u00e4r som liknar t.ex. https:\/\/dom\u00e4n.se\/scripts\/cron.php?key=value<\/p>\n\n\n\n

        4.<\/strong> Skicka resultat via e-post?<\/strong><\/h4>\n\n\n\n

        Du kan informeras via e-post om cron kommer att k\u00f6ras. I det h\u00e4r fallet \u00e4r det n\u00f6dv\u00e4ndigt att alltid v\u00e4lja alternativet att skicka utdata till e-post. Alternativt kan du bara skicka ett e-postmeddelande om cron har n\u00e5gon utdata.<\/p>\n\n\n\n

        5. Kommentar<\/strong>
        <\/h4>\n\n\n\n

        Det tj\u00e4nar f\u00f6r dina behov, till exempel f\u00f6r b\u00e4ttre differentiering av CRON-uppgifter. Obs visas bara i detta administrationsgr\u00e4nssnitt.<\/p>\n\n\n\n

        6. Aktiv uppgift<\/strong>
        <\/h4>\n\n\n\n

        Den h\u00e4r kryssrutan aktiverar eller inaktiverar CRON-uppgiften.<\/p>\n\n\n\n

        Beskrivning av parametrar (PHP) CRON<\/h2>\n\n\n\n

        Upprepningsinst\u00e4llningarna och till\u00e5tna v\u00e4rden \u00e4r desamma. Till skillnad fr\u00e5n WGET cron anges ocks\u00e5 skriptparametrar. Maximalt fyra parametrar kan anges.<\/p>\n\n\n\n

        Modellsituation, exempel p\u00e5 URL: https: \/\/www.domain.tld\/index.php? Option = com_unpaidreminder & tmpl = component & s = XxNBsQrfSr<\/p>\n\n\n\n

        <\/p>\n\n\n\n

        \"\"<\/figure>\n","protected":false},"excerpt":{"rendered":"

        Cron \u00e4r ett program som k\u00f6rs p\u00e5 v\u00e5ra servrar som du kan st\u00e4lla in vad och n\u00e4r du ska k\u00f6ras. Du kan anv\u00e4nda det till exempel n\u00e4r du uppdaterar databasen, g\u00f6r regelbundna s\u00e4kerhetskopior, nedladdning av information fr\u00e5n Internet etc. CRON-jobb \u00e4r mycket anv\u00e4ndbara f\u00f6r att automatisera repetitiva uppgifter. Med deras…<\/p>\n","protected":false},"author":8,"template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[64],"ht-kb-tag":[],"class_list":["post-759","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-webb-och-php-installningar"],"yoast_head":"\nCRON-jobb - Websupport kunskapsdatabas<\/title>\n<meta name=\"description\" content=\"Cron \u00e4r ett program som k\u00f6rs p\u00e5 v\u00e5ra servrar som du kan st\u00e4lla in vad och n\u00e4r du ska k\u00f6ras.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/\" \/>\n<meta property=\"og:locale\" content=\"sv_SE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CRON-jobb - Websupport kunskapsdatabas\" \/>\n<meta property=\"og:description\" content=\"Cron \u00e4r ett program som k\u00f6rs p\u00e5 v\u00e5ra servrar som du kan st\u00e4lla in vad och n\u00e4r du ska k\u00f6ras.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/\" \/>\n<meta property=\"og:site_name\" content=\"Websupport kunskapsdatabas\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-20T10:24:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kunskap.websupport.se\/app\/uploads\/sites\/4\/2021\/11\/chrome_FYRnBu1iuX-783x319.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minuter\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/\",\"url\":\"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/\",\"name\":\"CRON-jobb - Websupport kunskapsdatabas\",\"isPartOf\":{\"@id\":\"https:\/\/kunskap.websupport.se\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kunskap.websupport.se\/app\/uploads\/sites\/4\/2021\/11\/chrome_FYRnBu1iuX-783x319.png\",\"datePublished\":\"2020-12-01T15:08:00+00:00\",\"dateModified\":\"2021-12-20T10:24:09+00:00\",\"description\":\"Cron \u00e4r ett program som k\u00f6rs p\u00e5 v\u00e5ra servrar som du kan st\u00e4lla in vad och n\u00e4r du ska k\u00f6ras.\",\"breadcrumb\":{\"@id\":\"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/#breadcrumb\"},\"inLanguage\":\"sv-SE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/#primaryimage\",\"url\":\"https:\/\/kunskap.websupport.se\/app\/uploads\/sites\/4\/2021\/11\/chrome_FYRnBu1iuX.png\",\"contentUrl\":\"https:\/\/kunskap.websupport.se\/app\/uploads\/sites\/4\/2021\/11\/chrome_FYRnBu1iuX.png\",\"width\":1723,\"height\":702},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kunskap.websupport.se\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CRON-jobb\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kunskap.websupport.se\/#website\",\"url\":\"https:\/\/kunskap.websupport.se\/\",\"name\":\"Websupport kunskapsdatabas\",\"description\":\"Websupport kunskapsdatabas\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kunskap.websupport.se\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"sv-SE\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CRON-jobb - Websupport kunskapsdatabas","description":"Cron \u00e4r ett program som k\u00f6rs p\u00e5 v\u00e5ra servrar som du kan st\u00e4lla in vad och n\u00e4r du ska k\u00f6ras.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/","og_locale":"sv_SE","og_type":"article","og_title":"CRON-jobb - Websupport kunskapsdatabas","og_description":"Cron \u00e4r ett program som k\u00f6rs p\u00e5 v\u00e5ra servrar som du kan st\u00e4lla in vad och n\u00e4r du ska k\u00f6ras.","og_url":"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/","og_site_name":"Websupport kunskapsdatabas","article_modified_time":"2021-12-20T10:24:09+00:00","og_image":[{"url":"https:\/\/kunskap.websupport.se\/app\/uploads\/sites\/4\/2021\/11\/chrome_FYRnBu1iuX-783x319.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minuter"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/","url":"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/","name":"CRON-jobb - Websupport kunskapsdatabas","isPartOf":{"@id":"https:\/\/kunskap.websupport.se\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/#primaryimage"},"image":{"@id":"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/#primaryimage"},"thumbnailUrl":"https:\/\/kunskap.websupport.se\/app\/uploads\/sites\/4\/2021\/11\/chrome_FYRnBu1iuX-783x319.png","datePublished":"2020-12-01T15:08:00+00:00","dateModified":"2021-12-20T10:24:09+00:00","description":"Cron \u00e4r ett program som k\u00f6rs p\u00e5 v\u00e5ra servrar som du kan st\u00e4lla in vad och n\u00e4r du ska k\u00f6ras.","breadcrumb":{"@id":"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/#breadcrumb"},"inLanguage":"sv-SE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/"]}]},{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/#primaryimage","url":"https:\/\/kunskap.websupport.se\/app\/uploads\/sites\/4\/2021\/11\/chrome_FYRnBu1iuX.png","contentUrl":"https:\/\/kunskap.websupport.se\/app\/uploads\/sites\/4\/2021\/11\/chrome_FYRnBu1iuX.png","width":1723,"height":702},{"@type":"BreadcrumbList","@id":"https:\/\/kunskap.websupport.se\/kb\/cron-jobb\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kunskap.websupport.se\/"},{"@type":"ListItem","position":2,"name":"CRON-jobb"}]},{"@type":"WebSite","@id":"https:\/\/kunskap.websupport.se\/#website","url":"https:\/\/kunskap.websupport.se\/","name":"Websupport kunskapsdatabas","description":"Websupport kunskapsdatabas","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kunskap.websupport.se\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"sv-SE"}]}},"_links":{"self":[{"href":"https:\/\/kunskap.websupport.se\/wp-json\/wp\/v2\/ht-kb\/759","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kunskap.websupport.se\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/kunskap.websupport.se\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/kunskap.websupport.se\/wp-json\/wp\/v2\/users\/8"}],"version-history":[{"count":2,"href":"https:\/\/kunskap.websupport.se\/wp-json\/wp\/v2\/ht-kb\/759\/revisions"}],"predecessor-version":[{"id":20229,"href":"https:\/\/kunskap.websupport.se\/wp-json\/wp\/v2\/ht-kb\/759\/revisions\/20229"}],"wp:attachment":[{"href":"https:\/\/kunskap.websupport.se\/wp-json\/wp\/v2\/media?parent=759"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/kunskap.websupport.se\/wp-json\/wp\/v2\/ht-kb-category?post=759"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/kunskap.websupport.se\/wp-json\/wp\/v2\/ht-kb-tag?post=759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}