SFtp download triggers Database stored procedure.

Discuss Task Sequences and Scripting related issues.

SFtp download triggers Database stored procedure.

Postby melvin » Tue Mar 19, 2013 7:18 pm

User support Request:

Here is the scenario. We have a remote server where new files are added on a daily basis every hour between 07:00 and 20:00. The file name format is filename-mmddyy_hh_00.dat. ie file-031913_08_00.dat.

I need a process that will check each hour and down load the new file if there is one , rename it on the local server, make a copy and then trigger a stored procedure to update the sqlserver database. If there is not a new file then the process does not need to do anything. If there is an error I need the process to send me an email. This has to be an sftp-ssh process. I have already connected to the remote server using your sftp process.
melvin
Site Admin
 
Posts: 979
Joined: Thu May 25, 2006 10:20 am
Location: Santa Barbara, california

Postby Tech Support » Thu Mar 21, 2013 11:39 am

Create a new ‘Task Sequence’ with following steps:

Step 1 – SFTP download task (new task button / SFTP/SSH2 folder / Maverick / SFTP task)
Filename field = file-$%DATE::ppddyy_hh%$_00.dat
Step options: if exit code ==0 , go to step 100 (i.e. exit the task sequence) .

In the SFTP task , if files are transferred, then exit code = –100 . No error and no files transferred , exit code = 0. If error , exit code > 0.

In the SFTP task you can rename the local file during the transfer, as well as backup to another local directory. (i.e. 2 local files) . If you let us know exactly what you need to rename to , we can help you with this.

Step 2 – Create Database Stored Procedure task. (new task button / Database / Database SQL )



Email Notification:
Step 1: Settings / Email profiles. Create an email profile and test that it sends you an email.
Step 2: Settings / Email notification. Create an email notification with following settings:
Profile name = task_failure
Task List : All_Tasks
select option “send email if task exit code > 0”
fill out the rest..

This will send you email if any task fails (exit code > 0)
Tech Support
Site Admin
 
Posts: 1276
Joined: Thu May 25, 2006 11:12 am


Return to Task Sequences, Chains and Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron