Task scheduled for reboot in crontab did not run as expected

Hey there,

I am encountering some issues while trying to set up a cronjob on my Raspberry Pi. Although I believe that my code is correct, the cronjob does not seem to execute properly.

To access the crontab, I used the following command:

sudo crontab -e

Subsequently, I inserted the following line of code into it:

@reboot sleep 10 | node /PATH/index.js &

I also attempted this alternative approach:

@reboot sleep 10 && node /PATH/index.js &

After saving and exiting the file, I rebooted the system. Upon restarting, I checked if the cronjob was running with the following command:

Unfortunately, it appears that the cronjob is not being executed.

grep cron /var/log/syslog

The output showed that it is supposed to run the @reboot cronjobs, but they are currently not functioning as intended. Interestingly, my friend implemented the exact same code and steps successfully on his Raspberry Pi, yet it is not working on mine....

Thank you.

Answer №1

Although this thread is dated, I have found a useful solution by separating the commands with a semicolon. For instance, in the original poster's example, I would have written it as:

@reboot sleep 10 ; node /PATH/index.js

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Delivering information within a function utilizing callback functions

I am new to Node.js and I am still getting used to working with callbacks. Sometimes it can be frustrating for me. I have a function called downloadData() that downloads data, appends it to an empty array, and then sends that array. When downloading the d ...

The desktop menu disappears off the screen when attempting to hide it on a mobile device

My website has two menus, one on the left and one on the right, along with a search bar. When the user activates the menus, they smoothly slide in from the edge of the screen as intended. However, I encountered an issue where the right menu slides off the ...

Unable to render preview image in ReactCrop

When looking to add an image cropping feature to my web application, I discovered that react-image-crop is the ideal npm package for this task. However, I'm facing an issue where the preview generated by the ReactCrop component isn't appearing on ...

Error in Python CDLL ctypes package: The LibraryLoader object is not callable due to a type error

While attempting to upload a scenario with keyboard press simulation using the ctypes package in Python for a selenium webdriver, I encountered an issue. The code worked flawlessly on my local machine running Windows 8.1. However, when I tried running the ...

Troubleshooting: Why is Vue's v-if directive not updating after using on

I'm facing an issue where I want a div to only appear once a specific variable changes from false to true. I have tried changing the value of the variable once the component is mounted, but the v-if directive does not seem to work as expected in displ ...

Why React Native's array.map function fails to calculate the sum of a state

I am currently developing a COVID-19 data app for a school project, and I am struggling to sum the total number of tests and positive results from an API. Below is the snippet of code that I am using: function GetDataApi() { if(data !== null) { const ...

Attaching an External JSON Data File in JSFiddle

Can external JSON Data be linked within JSFiddle? Here is the code snippet I'm using to fetch the JSON Data: var xhr = new XMLHttpRequest(); xhr.open('GET', url: 'www.myurl.com/js/data/data.json', true); xhr.send(null); I have ...

Tips for activating a tooltip upon clicking instead of hovering over it:

I am currently working with tooltips and I am looking to display the tooltip message upon clicking, rather than on hover. Is there a way to make this modification? This is the code I have so far: .tooltip { position: absolute; top: 7px; margin-l ...

How Keyof can render an object undefined and prevent accurate verification

Encountering TS2532 error: Object is possibly 'undefined' while attempting to access an object's value by dynamically selecting the key. TypeScript seems to be restricting me from checking the field values, and I'm unsure of the underly ...

"Using Mongo and Express to retrieve a user by their ID results in an object being null

I've been attempting to retrieve a user object by ID using User.findById. When I make the request in Postman, it returns "user": null, even though the object with the included ID contains fields. Example of my object: { "_id" : ObjectId("5b3ca ...

Clear v-model without changing its associated values

I'm facing an issue with my <input> fields, which look like this: <input type="text" v-model=user.name" /> <input type="text" v-model="user.phone" /> <button @click="add">add user</button> Whenever the add user button i ...

fill an array with various input fields

Is there a way to utilize jQuery in order to fill an array with values extracted from input fields that possess the class 'seourl'... <input id="title" class="seourl" name="title" type="text" value="???"> <input id="subtitle" class="seo ...

JavaScript sorted arrays are an efficient way to keep data

In my dataset, I have an array of objects representing various products. Each product object includes a field called ratingReviews and another field called price, which can either be a string or an object. If the price is represented as an object, it conta ...

I'm curious why I need to add an extra await in my Vue.js unit test whenever multiple calls are made to my Firebase auth mock

In my vue.js application with firebase authentication, I encountered an issue while testing the Login.vue component. To mock firebase auth, I had to simulate the configuration file used for initializing firebase (named firebase.config). It's worth men ...

Press the button to access the URL within the current window

Working with Angular, I attempted to develop a function to open a URL in the current window. However, the code below within the controller actually opens a new window: $scope.openUrl = function(url) { $window.open(url); }; ...when using ng-click=&apo ...

Swapping out outdated identifiers with updated ones can be easily achieved using jQuery

My attempt to update my old ID with a new one has hit a snag. What steps can I take to troubleshoot this issue? $("#addfield").click(function(){ alert($(this).data('id')+1); $(this).data('id', + $('#addfield').data( ...

Manipulating Array Elements Post-Declaration in JavaScript

I have been searching for an answer to my question, but so far I haven't found anything. I am self-taught and have encountered a gap in my knowledge that is puzzling me. In a complex setup of connected pieces, I have two globally-scoped variables (es ...

The java servlet for multi-input form validation using ajax is malfunctioning as it fails to display any error messages

My Ajax form validation is not functioning properly. Despite the code provided below, errors are not being displayed when the text fields are left empty. <form id="postMveForm" action="movieDetails"> <input type="text" name="mvetitle" id="mveTit ...

What techniques can I employ in Angular to develop engaging widgets using plain HTML, without any Angular-specific elements?

I am currently developing a cutting-edge Angular application that serves as a training platform to offer online courses to users. Each course is essentially a set of "slides," which are HTML partials through which the user can navigate in order. These sli ...

What is the best way to retrieve a relative HTML table value?

I am facing an issue with getting the value from the second column in an HTML table when a button in the fourth column is clicked. Here is how I am creating the table: function loadTableData() { for (i=0; i < 7; i++) { let row = table.insert ...