issue210:c_c
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| issue210:c_c [2024/10/26 19:23] – créée auntiee | issue210:c_c [2024/10/29 17:37] (Version actuelle) – andre_domenech | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | Sorry guys, been spending the month in the hospital, so I’m doing this month’s command and conquer from my other computer. This means I cannot remember where we were precisely, so rather than re-doing something we have done, or skipping something, let’s skip to another part of the LPIC exam people have issues with. | + | **Sorry guys, been spending the month in the hospital, so I’m doing this month’s command and conquer from my other computer. This means I cannot remember where we were precisely, so rather than re-doing something we have done, or skipping something, let’s skip to another part of the LPIC exam people have issues with. |
| Cron | Cron | ||
| Ligne 5: | Ligne 5: | ||
| So if you ever typed ‘man cron’, you may be bombarded with information, | So if you ever typed ‘man cron’, you may be bombarded with information, | ||
| - | Cron runs only when the computer does, so if you close your laptop and it hibernates or sleeps, cron does not run. You may have noticed that the files inside *my cron.daily folder, in the image, is green. That is because if the files in there are not executable, they do not run. (Sounds logical, but you would be surprised at how often it bowled someone over). | + | Cron runs only when the computer does, so if you close your laptop and it hibernates or sleeps, cron does not run. You may have noticed that the files inside *my cron.daily folder, in the image, is green. That is because if the files in there are not executable, they do not run. (Sounds logical, but you would be surprised at how often it bowled someone over).** |
| - | We can do a quick example by making a script, and putting it in one of the folders, and see if it runs. Just keep in mind that this method does not give one fine-grained control. By this I mean, the file I put in the daily folder will run every day, but I cannot tell it to run at, say, ten to four in the morning. For that we use another method. | + | Désolé les gars, j'ai passé le mois à l' |
| + | |||
| + | Cron | ||
| + | |||
| + | Si vous avez déjà tapé « man cron », vous avez peut-être été bombardé d' | ||
| + | |||
| + | Cron ne s' | ||
| + | |||
| + | **We can do a quick example by making a script, and putting it in one of the folders, and see if it runs. Just keep in mind that this method does not give one fine-grained control. By this I mean, the file I put in the daily folder will run every day, but I cannot tell it to run at, say, ten to four in the morning. For that we use another method. | ||
| Open your favourite editor and let’s make a simple script: | Open your favourite editor and let’s make a simple script: | ||
| Ligne 17: | Ligne 25: | ||
| touch here.txt | touch here.txt | ||
| - | Save it, make it executable with chmod +x and we are ready to go. Always test your scripts first. Once you know it works, remove the folder it created and let's pop it into cron.hourly. | + | Save it, make it executable with chmod +x and we are ready to go. Always test your scripts first. Once you know it works, remove the folder it created and let's pop it into cron.hourly.** |
| - | Now continue to enjoy your free magazine and you can check it again in an hour. This is an easy way to run scripts, however if you take the LPIC exam, they will want to know if you can remember the minute, hour, day of month, month, day of week. In Ubuntu, it is visible in a helpful comment, but for the exam, they will not give it to you, instead wanting you to remember the order. You can use a mnemonic, like my house of dominoes mowed down, to remember it. If you have trouble visualising how the numbering works, I suggest playing online with crontab guru: https:// | + | Nous pouvons faire un exemple rapide en créant un script et en le plaçant dans l'un des dossiers, et voir s'il s' |
| + | |||
| + | Ouvrez votre éditeur préféré et créons un simple script : | ||
| + | |||
| + | #!/bin/sh | ||
| + | |||
| + | mkdir -p ~/fcm | ||
| + | cd ~/fcm | ||
| + | touch here.txt | ||
| + | |||
| + | Sauvegardez-le, | ||
| + | |||
| + | |||
| + | **Now continue to enjoy your free magazine and you can check it again in an hour. This is an easy way to run scripts, however if you take the LPIC exam, they will want to know if you can remember the minute, hour, day of month, month, day of week. In Ubuntu, it is visible in a helpful comment, but for the exam, they will not give it to you, instead wanting you to remember the order. You can use a mnemonic, like my house of dominoes mowed down, to remember it. If you have trouble visualising how the numbering works, I suggest playing online with crontab guru: https:// | ||
| At the bottom of the page, you will see “examples” – I suggest you look closely at those as I recall examples in the test were exactly what you saw there. | At the bottom of the page, you will see “examples” – I suggest you look closely at those as I recall examples in the test were exactly what you saw there. | ||
| - | Let us use this time to do something with crontab (Cron table). Please remember that crontab is different per user. You can specify the user with the tack: -u For now, I want you to do this with your own user or a test user on your system. If your system has a file named / | + | Let us use this time to do something with crontab (Cron table). Please remember that crontab is different per user. You can specify the user with the tack: -u For now, I want you to do this with your own user or a test user on your system. If your system has a file named / |
| + | |||
| + | Maintenant, continuez à profiter de votre magazine gratuit et vous pourrez le vérifier à nouveau dans une heure. C'est un moyen facile d' | ||
| + | |||
| + | Au bas de la page, vous verrez « examples ». Je vous suggère de les regarder attentivement car je me souviens que les exemples du test étaient exactement ce que vous verrez là. | ||
| + | |||
| + | Profitons-en pour faire quelque chose avec crontab (table Cron). N' | ||
| - | Please type crontab -l first to see if you have an existing file created. | + | **Please type crontab -l first to see if you have an existing file created. |
| The choice here is up to you, but as it is a newbie tutorial, I’m going with nano. | The choice here is up to you, but as it is a newbie tutorial, I’m going with nano. | ||
| Ligne 39: | Ligne 67: | ||
| What you need to know for the exam: | What you need to know for the exam: | ||
| - | There is an ‘at daemon’ running in the background, atd, that will check the job queue for jobs to run. The other thing that comes up that you need to know is that the ‘at’ command submits the job to that very queue. Other than that, it did not go into detail. You may have noticed that there is no man entry for ‘at’ in Ubuntu as it is not installed by default. (It is not difficult to install). So, if you want to know more, I’ll be pointing you to the interwebs as I have limited space in the magazine: https:// | + | There is an ‘at daemon’ running in the background, atd, that will check the job queue for jobs to run. The other thing that comes up that you need to know is that the ‘at’ command submits the job to that very queue. Other than that, it did not go into detail. You may have noticed that there is no man entry for ‘at’ in Ubuntu as it is not installed by default. (It is not difficult to install). So, if you want to know more, I’ll be pointing you to the interwebs as I have limited space in the magazine: https:// |
| - | Because things change in exams, and the last time I gave a class in this, it was two exam versions ago, I’d just like to point out that ‘at’ does not only consist of ‘at’ and its daemon, there are other files involved, namely: | + | Tapez d' |
| + | |||
| + | Le choix est libre, mais comme il s'agit d'un tutoriel pour débutants, j'opte pour nano. | ||
| + | |||
| + | Dans l' | ||
| + | |||
| + | Nous l' | ||
| + | |||
| + | Maintenant, toutes les 5 minutes, mon script s' | ||
| + | |||
| + | L' | ||
| + | |||
| + | Ce que vous devez savoir pour l' | ||
| + | |||
| + | Il y a un « démon at », atd, qui tourne en arrière-plan et qui vérifie la file d' | ||
| + | |||
| + | |||
| + | **Because things change in exams, and the last time I gave a class in this, it was two exam versions ago, I’d just like to point out that ‘at’ does not only consist of ‘at’ and its daemon, there are other files involved, namely: | ||
| /usr/bin/at | /usr/bin/at | ||
| / | / | ||
| Ligne 55: | Ligne 100: | ||
| A favourite of mine for homework, was to get students to play a gong wave file every hour via cron. I suggest you try and do that too, then maybe make it play every hour and one minute and so forth, making a game out of it will make it stick much better than any Youtube video will. | A favourite of mine for homework, was to get students to play a gong wave file every hour via cron. I suggest you try and do that too, then maybe make it play every hour and one minute and so forth, making a game out of it will make it stick much better than any Youtube video will. | ||
| - | As always, if I made a mistake: misc@fullcirclemagazine.org | + | As always, if I made a mistake: misc@fullcirclemagazine.org** |
| + | |||
| + | Parce que les choses changent dans les examens et que la dernière fois que j'ai donné un cours sur ce sujet, c' | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | |||
| + | Puisque le cours LPIC est agnostique en matière de distro, je vous suggère de classer ces éléments dans un endroit où vous pourrez vous en souvenir si nécessaire. | ||
| + | |||
| + | Le fait de lancer une commande ou un script à un moment donné n'est pas difficile, mais le guide de l' | ||
| + | |||
| + | L'un de mes devoirs préférés consistait à demander aux étudiants de jouer le fichier wave d'un gong toutes les heures via cron. Je vous suggère d' | ||
| + | |||
| + | Comme toujours, si j'ai fait une erreur : misc@fullcirclemagazine.org | ||
issue210/c_c.1729963384.txt.gz · Dernière modification : 2024/10/26 19:23 de auntiee
